Fetch a customer
| POST | /customers/show |
|---|
Use this endpoint to retrieve details of a customer.
Header
Authorization
Example: Bearer {YOUR_AUTH_KEY}
Content-Type
Example: application/json
Accept
Example: application/json
Request Parameters
| Parameter | Datatype | Description |
|---|---|---|
| string | The customer's email address. | |
| customer_code | string | The customer's unique code. |
| contact_person_phone | string | The customer's phone number. |
| company_phone | string | The company's phone number. |
Note : To fetch a customer, you may utilize any one of the parameters mentioned above at a time.
Response Parameters
| Parameter | Datatype | Description |
|---|---|---|
| id | integer | The unique identifier of the customer. |
| contact_person_name | string | The name of the customer. |
| company_name | string | The name of the customer's company. |
| display_name | string | The name of the customer's company. |
| string | The customer's email address. | |
| contactperson_number | string | The customer's contact number. |
| company_phone | string | The company's contact number. |
| gst_treatment | string | This indicates whether the customer is GST-registered or not. |
| gstin | string | This is the customer's GST number. |
| customer_code | string | This is the customer's unique identifier code. |
| status | string | The customer's status can be either "Active" or "Inactive". |
| approval | string | The status of the customer approval & possible values are ('pending','accepted','rejected'). |
| address | collection | Collection of customer 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. |
Sample Request
curl --location 'https://testwebservices.sourcehub.in/api/customers/show?contact_person_phone=1230987654' \
--header 'Authorization: Bearer ***********'
Sample Success Response
{
"data": {
"id": 3424,
"contact_person_name": "Arun Sen",
"company_name": "Arun Store",
"display_name": "Arun Store",
"email": "",
"contactperson_number": "1230987654",
"company_phone": null,
"gst_treatment": "Registered",
"gstin": "",
"customer_code": null,
"status": "Active",
"approval": "accepted",
"address": {
"addressline1": "Bangalore",
"addressline2": "",
"area": {
"id": 112,
"name": "Agaram",
"area_code": "",
"city": {
"id": 1,
"name": "Bengaluru",
"code": "BEN1",
"state": {
"id": 1,
"code": "K001",
"name": "Karnataka"
}
}
},
"postalcode": {
"id": 31,
"code": "560030"
}
}
}
}
Sample 401 Faliure Response
{
"error": {
"code": "AUTHENTICATION_ERROR",
"description": "Invalid credential or token.",
"source": "https://testwebservices.sourcehub.in/api/customers/show",
"status_code": 401
}
}
Sample 404 Faliure Response
{
"error": {
"code": "BAD_REQUEST_ERROR",
"description": "The value of the parameter provided does not exist.",
"source": "https://testwebservices.sourcehub.in/api/customers/show",
"status_code": 404
}
}
Errors
1. The API key/secret provided is invalid. Error Status: 401
The API credentials used in your request do not match those generated on the Dashboard. This discrepancy may be due to one of the following reasons:
- Different Keys: Ensure you are using the correct keys for either test mode or live mode.
- Expired Key: The API key may have expired.
Solution :
To resolve this issue, please verify that your API keys are active and entered correctly. Ensure there are no leading or trailing whitespaces around the keys. This version is clearer and more structured, making it easier for users to understand the problem and solution.
2. The parameter provided does not exist. Error Status: 404
The provided email, customer code, contact person phone number, or company phone number does not exist or is not associated with the requestor.
Solution : Please verify and use a valid email, customer code, contact person phone number, or company phone number that is linked to the requestor. This version maintains clarity while enhancing professionalism and readability.
3. email/customer_code/contact_person_phone/company_phone is not valid. Error Status: 404
The email/customer_code/contact_person_phone/company_phone passed is invalid.
Solution : Use valid email/customer_code/contact_person_phone/company_phone.
4. Too many parameters. Error Status: 404
It seems that multiple parameters have been submitted for a single request.
Solution : Please ensure that only one parameter is included with a value for each request. This version clarifies the issue and presents the solution in a more structured manner.