This API provides an interface to create an address and link it to customer account.
This API only accepts POST
requests.
https://dev-api.aymakan.com.sa/v2/address/create
https://api.aymakan.net/v2/address/create
The following headers should be sent along with the request
Your account security code / Api Token
Below is the list of parameters which should be sent to this API to create customer address.
{info} The request parameters should be sent in request body using JSON format.
Parameter | Type | Required | Description |
---|---|---|---|
title | string | Yes | title |
name | string | Yes | customer name |
string | Yes | customer email | |
city | string | Yes | customer city |
address | string | Yes | customer address |
neighbourhood | string | Yes | customer neighbourhood |
postcode | string | Yes | customer postcode |
phone | string | Yes | customer phone number |
description | string | Yes | description detail |
A sample POST
request body is below:
{
"title": "Aymkana",
"name": "test",
"email": "[email protected]",
"city": "Riyadh",
"address": "Saudi Arabia Makkah{Mecca} Jeddah Al Muntazahat شارع العام طريق الحرزات 03088",
"neighbourhood": "Al Wizarat",
"postcode": "75760",
"phone": "+966598998110",
"description": "Home address"
}
The following response will be returned upon success.
{
"success": 1,
"data": {
"address": {
"id": 1,
"title": "Aymkana",
"name": "test",
"email": "[email protected]",
"city": "Riyadh",
"address": "Saudi Arabia Makkah{Mecca} Jeddah Al Muntazahat شارع العام طريق الحرزات 03088",
"postcode": "75760",
"neighbourhood": "Al Wizarat",
"phone": "+966598998110",
"country": "SA",
"description": "Home address"
}
}
}
In case of any error, a standard validation error will be returned with 422
http status code.
Below is a sample of error response.
To avoid an error like this , make sure all required data is entered correctly.
{
"error": true,
"message": "Validation Error.",
"errors": {
"title": [
"The title field is required."
]
}
}
In case of invalid credentials 401 Unauthorized
, the following response will be returned.
{
"error": true,
"response": "Invalid Credentials"
}