0% found this document useful (0 votes)
2 views6 pages

Client API Documentation

The Client API Documentation provides endpoints for user authentication, profile retrieval, order creation, and management. It includes details on request methods, headers, request bodies, and expected responses for each API. Recommendations for improvements such as standardizing endpoint naming and adding pagination are also included.

Uploaded by

asim.expressfly
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views6 pages

Client API Documentation

The Client API Documentation provides endpoints for user authentication, profile retrieval, order creation, and management. It includes details on request methods, headers, request bodies, and expected responses for each API. Recommendations for improvements such as standardizing endpoint naming and adding pagination are also included.

Uploaded by

asim.expressfly
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Client API Documentation

# Client API Documentation

Base URL:
[Link]

Authentication:
Most APIs require JWT authentication using the Authorization header.

------------------------------------------------------------
1. LOGIN API
------------------------------------------------------------

Method:
POST

Endpoint:
/api/client/unicommerce/authToken

Description:
Authenticates a user and returns JWT token.

Headers:
Content-Type: application/json

Request Body:
{
"username": "username",
"password": "password"
}

Success Response:
{
"success": true,
"message": "Login successful",
"token": "JWT_TOKEN_HERE"
}

Error Response:
{
"success": false,
"message": "Invalid credentials"
}

Status Codes:
200 - Success
400 - Validation Error
401 - Unauthorized
500 - Internal Server Error

------------------------------------------------------------
2. GET PROFILE API
------------------------------------------------------------

Method:
GET

Endpoint:
/api/client/auth/get-profile

Description:
Fetch authenticated user profile details.

Headers:
Authorization: JWT_TOKEN

Success Response:
{
"success": true,
"data": {
"id": "USER_ID",
"name": "John Doe",
"email": "john@[Link]"
}
}

Error Response:
{
"success": false,
"message": "Unauthorized access"
}

Status Codes:
200 - Success
401 - Unauthorized
500 - Internal Server Error

------------------------------------------------------------
3. CREATE ORDER API
------------------------------------------------------------

Method:
POST
Endpoint:
/api/client/create

Description:
Creates a new shipment/order.

Headers:
Authorization: JWT_TOKEN
Content-Type: application/json

Request Body:
{
"name": "YashHHHHHHHHHHH",
"mobile_no": "9191794613",
"alternate_mobile_no": null,
"email_id": "yds@[Link]",
"shipment_type": 0,
"receiver_address": "Vasai",
"receiver_pincode": "401107",
"receiver_city": "Mumbai",
"receiver_state": "MH",
"receiver_landmark": null,
"order_no": "#EXP01TESTTTTTTaaa",
"order_type": 0,
"product_quantity": 12,
"cod_amount": 2784,
"product_discount": 0,
"order_total_tax_amount": 0,
"order_total_shipping_amount": 0,
"physical_weight": 1,
"product_length": 12,
"product_width": 12,
"product_height": 12,
"dead_weight": 0.35,
"chargeable_weight": 1,
"hsn_number": "432546",
"eway_bill_number": null,
"order_value": 2784,
"productdetatis": [
{
"product_sku": "4321",
"product_name": "book",
"product_quantity": 12,
"product_value": 232,
"actual_value": 0,
"gst_tax": 0
}
],
"pickup_address_id": "69fc5a00e139167137c64d2f"
}

Status Codes:
201 - Created
400 - Validation Error
401 - Unauthorized
500 - Internal Server Error

------------------------------------------------------------
4. ORDER LIST API
------------------------------------------------------------

Method:
GET

Endpoint:
/api/client/getorder

Description:
Fetch all orders.

Headers:
Authorization: JWT_TOKEN

Success Response:
{
"success": true,
"data": []
}

------------------------------------------------------------
5. SINGLE ORDER API
------------------------------------------------------------

Method:
GET

Endpoint:
/api/client/orders/:id

Description:
Fetch single order details.

Path Parameters:
id - Order ID
Headers:
Authorization: JWT_TOKEN

------------------------------------------------------------
6. EDIT ORDER API
------------------------------------------------------------

Method:
PUT

Endpoint:
/api/client/updateOrder/:id

Description:
Update existing order.

Headers:
Authorization: JWT_TOKEN
Content-Type: application/json

Path Parameters:
id - Order ID

Request Body:
Same structure as Create Order API.

------------------------------------------------------------
7. GET SHIPPING RATES API
------------------------------------------------------------

Method:
GET

Endpoint:
/api/client/get-rates/:orderId

Description:
Fetch available shipping/courier rates.

Headers:
Authorization: JWT_TOKEN

Path Parameters:
orderId - Order ID

------------------------------------------------------------
NOTES & RECOMMENDATIONS
------------------------------------------------------------
1. Rename typo field:
productdetatis -> productDetails

2. Standardize endpoint naming:


/orders
/orders/:id
/orders/:id/rates

3. Add API versioning:


/api/v1/

4. Add Swagger/OpenAPI support.

5. Add pagination to order listing API.

You might also like