Fetch a Sales Order With ID

GET /orders/{id}

Utilize this endpoint to obtain detailed information about a specific sales order based on its ID.

Header

                    
                        Authorization
                        Example: Bearer {YOUR_AUTH_KEY}
                        Content-Type
                        Example: application/json
                        Accept
                        Example: application/json
                    
                

URL Parameters

Parameter Datatype Description
id Integer(required) This is a product id

Response Parameters

Parameter Datatype Description
data object This object contains the entire resource.
id Integer The unique identifier for a single order.
order_no String The unique identifier for a single order.
item_total_amount Double Total order amount.
discount_amount Double Total discount availed by the customer.
return_total_amount Double Total amount of returned products.
billable_amount Double Total amount payable by the customer.
date DATE Format (YYYY-MM-DD).
products Collection The list of products associated with the order.
products.id Integer The unique product identifier.
products.sku String The unique product identifier.
products.name String The product name.
products.quantity Integer The quantity of the product sold.
products.price Integer The selling price of the product.
customer Collection The customer's information associated with the order.
customer.id Integer The customer's unique identifier.
customer.contact_person_name String The customer's name.
customer.company_name String The name of the customer's company.
customer.display_name String The customer's display name.
customer.email String The customer's email address.
customer.contactperson_number String The customer's contact number.
customer.company_phone String The company's contact number.
customer.gst_treatment String This indicates whether the customer is GST-registered or not.
customer.gstin String This is the customer's GST number.
customer.customer_code String This is the customer's unique identifier code.
address collection Collection of customer's address.
address.addressline1 String This is the first line of the customer's address.
address.addressline2 String This is the second line of the customer's address.
address.area Collection Collection of area.
address.area.id Integer The unique identifier of the area.
address.area.name String The name of the area.
address.area.area_code String The code of the area.
address.area.city Collection Collection of city.
address.area.city.id Integer The unique identifier of the city.
address.area.city.name String The name of the city.
address.area.city.code String The code of the city.
address.area.city.state Collection Collection of state.
address.area.city.state.id Integer The unique identifier of the state.
address.area.city.state.code String The code of the state.
address.area.city.state.name String The name of the state.
address.postalcode Collection Collection of ZIP code.
address.postalcode.id Integer The unique identifier of the ZIP code.
address.postalcode.code String The ZIP code.
salesagent Collection The salesagent's information associated with the order.
salesagent.id Integer The salesagent's unique identifier.
salesagent.first_name String The salesagent's first name.
salesagent.last_name String The salesagent's last name.
salesagent.mobile_number String The salesagent's mobile number.
salesagent.avatar String The full path to the salesagent's avatar image. (Will be null if not available)
salesagent.email String The salesagent's email address.
deliveryagent Collection The deliveryagent's information associated with the order.
deliveryagent.id Integer The deliveryagent's unique identifier.
deliveryagent.first_name String The deliveryagent's first name.
deliveryagent.last_name String The deliveryagent's last name.
deliveryagent.phone_number String The deliveryagent's phone number.
laststatus Collection The order status information associated with the order.
laststatus.name String The current status of the order. Possible values include : Placed, Processed, In Review/Invoice Dept, Shipment Created, Delivered, Cancelled, Returned, Invoice Generated, Undelivered & Postponed
invoices Collection Orders may have multiple invoices. Invoice details associated with the order.
invoices.id Integer The unique invoice identifier.
invoices.invoice_number String The unique invoice identifier.
invoices.date DATE Format YYYY-MM-DD.
invoices.due_date DATE Format YYYY-MM-DD. Invoice due date.
invoices.total_amount Double Total sale's amount.
invoices.discount_amount Double Total discount amount.
invoices.returned_amount Double Total amount of returned items (If any).
invoices.invoice_amount Double Total invoice amount.
invoices.cgst Double Total CGST amount.
invoices.sgst Double Total SGST amount.
invoices.igst Double Total IGST amount.

Sample Request

                    
                        curl --location 'https://webservices.sourcehub.in/api/orders/874' \
--header 'Authorization: Bearer ************'
                    
                

Sample Success Response

                    
                        {
                            "data": {
                                "id": 874,
                                "order_no": "00865",
                                "item_total_amount": 65000,
                                "discount_amount": 0,
                                "return_total_amount": 0,
                                "billable_amount": 65000,
                                "date": "2021-06-08",
                                "products": [
                                    {
                                        "id": 257,
                                        "sku": "sku98",
                                        "name": "necklace",
                                        "quantity": 1,
                                        "price": 65000
                                    }
                                ],
                                "customer": {
                                    "id": 3,
                                    "contact_person_name": "test new",
                                    "company_name": "testing",
                                    "display_name": "testing",
                                    "email": null,
                                    "contactperson_number": "6396281335",
                                    "company_phone": "6396281331",
                                    "gst_treatment": "Registered GST",
                                    "gstin": "7896GHYO2030256",
                                    "customer_code": "1625035402",
                                    "address": []
                                },
                                "salesagent": [],
                                "deliveryagent": {
                                    "id": 1,
                                    "first_name": "archa",
                                    "last_name": "jha",
                                    "phone_number": "7697602300"
                                },
                                "laststatus": {
                                    "name": "Shipment Created"
                                },
                                "invoices": [
                                    {
                                        "id": 877,
                                        "invoice_number": "INV-21-00001",
                                        "date": "2021-06-08",
                                        "due_date": "2021-06-08",
                                        "total_amount": 65000,
                                        "discount_amount": 0,
                                        "returned_amount": 0,
                                        "invoice_amount": 65000,
                                        "cgst": 0,
                                        "sgst": 0,
                                        "igst": 0
                                    }
                                ]
                            }
                        }
                    
                

Sample 401 Faliure Response

                    
                        {
                            "error": {
                                "code": "AUTHENTICATION_ERROR",
                                "description": "Invalid credential or token.",
                                "source": "https://webservices.sourcehub.in/api/orders/874",
                                "status_code": 401
                            }
                        }
                    
                

Sample 404 Faliure Response

                    
                        {
                            "error": {
                                "code": "BAD_REQUEST_ERROR",
                                "description": "The id provided does not exist.",
                                "source": "https://webservices.sourcehub.in/api/orders/17580",
                                "status_code": 404
                            }
                        }
                    
                

Errors

1. The API key/secret provided is invalid. Error Status: 401

The API credentials passed in the API call differ from the ones generated on the Dashboard. Possible reasons are:

  • Different keys for test mode and live modes.
  • Expired API key.

Solution :
The API keys must be active and entered correctly with no whitespace before or after the keys.

2. The ID provided does not exist. Error Status: 404

The ID does not exist or does not belong to the requestor.

Solution : Ensure that you use a valid ID that belongs to the requestor.

3. ID is not a valid ID. Error Status: 404

The ID passed is invalid.

Solution : Use a valid ID.

CONTENTS