Customers API
Customers API is a tool that allows businesses to manage and retrieve customer information securely and efficiently. With this API, businesses can integrate customer management functionalities into their websites, applications, and other software solutions.
It supports features such as pagination, search by ID, and search by name or email. It also provides detailed customer information including name, email, phone, and more.
Get a list of all customers¶
Endpoint
GET /v1/customers/
This endpoint retrieves a list of all customers with pagination support. By default, it shows 10 customers per page. You can specify the page number and the number of customers per page using the page
and page_size
parameters.
Fields:
Parameter | Description | Type | Required |
---|---|---|---|
page | The page number to retrieve | integer | true |
page_size | The number of customers to display per page | integer | true |
Request Example:
curl 'https://api.4geeks.io/v1/customers/' \
-X GET \
-H 'authorization: bearer PdSKf04xi9LEcvcwIAdbWAXVg380Kz' \
-F 'page=2' \
-F 'page_size=2'
Response Example:
{
"count": 2,
"next": "https://api.4geeks.io/v1/customers/?page=3&page_size=2",
"previous": "https://api.4geeks.io/v1/customers/?page_size=2",
"results": [
{
"id": "03124bfa-a8gd-4e63-823f-90540b9akcff",
"developer": 3468,
"first_name": "Alex",
"last_name": "Miller",
"email": "alexmiller@gmail.com",
"phone": null,
"photo": null,
"country": "USA",
"metadata": null,
"test": true
},
{
"id": "023d3c4c-1945-42d8-981a-02e6a3a8fhd0",
"developer": 3468,
"first_name": "Alejandro",
"last_name": "Alfaro",
"email": "alejandroalfaro@gmail.com",
"phone": null,
"photo": "https://storage.googleapis.com/g-payments.appspot.com/img/Alejandro_Alfaro_test_1694273021.jpeg",
"country": "Argentina",
"metadata": null,
"test": true
}
]
}
Get a specific customer¶
Endpoint
GET /v1/customers/{id}/
This endpoint retrieves the details of a specific customer using their unique ID. The ID is passed directly in the URL, and no additional parameters are required in the request body.
Fields:
Parameter | Description | Type | Required |
---|---|---|---|
id | The unique identifier of a customer (passed in the URL) | integer | true |
Request Example:
curl 'https://api.4geeks.io/v1/customers/03124bfa-a8gd-4e63-823f-90540b9akcff/' \
-X GET \
-H 'authorization: bearer PdSKf04xi9LEcvcwIAdbWAXVg380Kz'
Response Example:
{
"id": "03124bfa-a8gd-4e63-823f-90540b9akcff",
"developer": 3468,
"first_name": "Alex",
"last_name": "Miller",
"email": "alexmiller@gmail.com",
"phone": null,
"photo": null,
"country": "USA",
"metadata": null,
"test": true
}
Search for a customer¶
Endpoint
GET /v1/customers/?search={query}
This endpoint retrieves a list of customers matching a search query by name or email.
Fields:
Parameter | Description | Type | Required |
---|---|---|---|
search | The search query to match by name or email | string | true |
Request Example:
curl 'https://api.4geeks.io/v1/customers/?search=Alejandro' \
-X GET \
-H 'authorization: bearer PdSKf04xi9LEcvcwIAdbWAXVg380Kz'
-F 'search=Alejandro'
Response Example:
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": "033d2c5c-1965-41d9-981a-03e5a8a8fed0",
"developer": 3468,
"first_name": "Alejandro",
"last_name": "Madrigal",
"email": "alejandromadrigal@gmail.com",
"phone": null,
"photo": null,
"country": "USA",
"metadata": null,
"test": true
},
{
"id": "023d3c4c-1945-42d8-981a-02e6a3a8fhd0",
"developer": 3468,
"first_name": "Alejandro",
"last_name": "Alfaro",
"email": "alejandroalfaro@gmail.com",
"phone": null,
"photo": "https://storage.googleapis.com/g-payments.appspot.com/img/Alejandro_Alfaro_test_1694273021.jpeg",
"country": "Argentina",
"metadata": null,
"test": true
}
]
}
Error Handling¶
The API returns standard HTTP status codes to indicate the success or failure of a request. Below are some common errors:
Status Code | Error Message | Description |
---|---|---|
400 | Bad Request | The request is malformed or missing required parameters. |
401 | Unauthorized | The request lacks valid authentication credentials. |
404 | Not Found | The requested resource (e.g., customer ID) does not exist. |
500 | Internal Server Error | An unexpected error occurred on the server. Contact support for assistance. |
Example error response: