Categorygithub.com/RakaiSeto/simple-app-may
repository
0.0.0-20220808033120-76bdc84b7985
Repository: https://github.com/rakaiseto/simple-app-may.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

Simple Rakai App API

This API allows you to order product and pay it with midtrans

The API is doesn't have a public url yet

Endpoints

Hello

GET /hello

Check if API is running.

List of products

GET /product

Returns a list of products.

Get a single product

GET /product/:id

Retrieve detailed information about a product.

The response body will contain the order Id.

Get all orders

GET /order

Allows you to view all of your orders. Login is required.

Get an order

GET /order/:id

Allows you to see an existing order. Login is required.

Submit an order

POST /order

Allows you to submit a new order. Login is required.

The request body needs to be in JSON format and include the following properties:

  • order_products - Object - Required
    • orderProduct - Array - Required
      • id - Integer - Required
      • quantity - Integer - Required
  • payment_method - Integer - Required

Example

POST /order

{
	"order_products":  {
		"OrderProduct":  [
			{
				"id":  2,
				"quantity":  1
			}
		]
	},
	"payment_method":  1
}

Delete an order

DELETE /order/:id

Delete an existing order. Login is required.

The request body needs to be empty.

Example

DELETE /orders/PF6MflPDcuhWobZcgmJy5

My Profile

GET /profile See detailed information about your profile. Login is required.

Patch User Information

PATCH /user Patch information about your profile. Login is required.

The request body needs to be in JSON format and include the following properties:

  • email - String - Optional
  • password - String- Optional

Delete User

DELETE /user Delete user from database, tho transaction history won't be deleted

API Authentication

Manual Register

POST /register

The request body needs to be in JSON format and include the following properties:

  • uname - String - Unchangeable later
  • password - String
  • email - String

Example

{
   "uname": "Postman",
   "password": "tes12345"
   "email": "[email protected]"
}

Possible errors

Status code 409 - "API client already registered." Try changing the values for email and uname to something else.

Login With Github

GET /logingithub

You will be redirected to github for further process

Login With Facebook

GET /login/facebook

You will be redirected to facebook for further process

Login With Google

GET /login/google

You will be redirected to google for further process