Introduction
Welcome to the API documentation. This documentation is intended for developers who want to write applications that can interact with the API.
ملاحظة
When making API requests to any API endpoint, developers should ensure to include the necessary request headers as per the API's requirements and specifications. there are some common headers that developers should consider including:
Request Header
Key | Description |
---|---|
Authorization | The API requires a bearer token for user authentication, and the initialize API generates a new token and returns a guest user profile if none is sent; otherwise, it provides the profile of the authenticated user. |
lang | the language of the response that the client expects. In the provided description, the values are used to represent 1 to English and 2 to Arabic. |
Content-Type | the format or type of the request payload being sent to the server. In the provided description, the Content-Type is set to json, indicating that the request payload is in JSON format. |
api-key | The api-key is a unique token assigned by the website, critical for multi-tenant projects. In the web version, the Referer key indicates the request's source URL from various websites, sent by default with the browser. |
device | The device type of the client. In the provided description, the values are used to represent 1 to Android and 2 to iOS. |
Api Key
حذر
The api-key
request header, which represents the API key of a website, can typically be obtained from the admin panel in the Configuration > API Integration
section.
Success Response
Key | Type | Description |
---|---|---|
code | Integer | The HTTP status code indicating the success or failure of the API request. |
message | String | A field provides a human-readable description or summary of the response status. It gives additional information to developers or clients about the outcome of the API request. In this case, the message is "Success" indicating that the request was successful. |
data | Object | The actual payload of the API response. It includes the relevant information requested by the client or any data that the API is returning as a result of the request. The structure and content of the "data" field can vary depending on the specific API endpoint. |
200 OK - If the request is successful
{
"code": 200,
"message": "Success",
"data": {
//...
}
}
Status Codes
HTTP Status Codes
Code | Description |
---|---|
200 | Successful request. check response for custom code and message details to understand the specific result received. |
500 | The server encountered an unexpected condition that prevented it from fulfilling the request. |
General Status Codes
Code | Description |
---|---|
200 | The request was successful. |
401 | The request requires an authentication token. |
404 | The requested API was not found, or the user associated with the request could not be registered. |
Specific For APIs Status Codes
Code | Description |
---|---|
201 | The request was successful and a new order was created. Used Api
|
202 | The request for pay order online was successful, and you should open the returned link in an iframe within a modal popup. Used Api
|
203 | The request for pay order online was successful, and you should redirect the user to the returned link in a new window. Used Api |
409 | The request cannot be processed because the customer's phone is not verified. Used Api
|
422 | The request cannot be processed because the customer's phone is not found. Used Api
|
423 | The checkout order request failed due to order validation issues, refer to the error message for specific details. Used Api |