User Address
The User Address APIs provide a set of endpoints to manage the addresses associated with a user. This includes creating, retrieving, updating, and deleting addresses. Each operation is authenticated through an authorization token, ensuring that only authorized users can manage their address data.
This documentation provides examples of how to use these endpoints with sample requests and responses, making it easier for developers to integrate user address management into their applications.
POST
Create User Address
POST
Create User AddressCreates a new address for the user authenticated by the provided Authorization token.
Path: https://{storefront_url}/address/
Headers:
Authorization: Token <token>
Body Parameters
title
string
true
Title of the address.
first_name
string
true
The first name of the user.
last_name
string
true
The last name of the user.
phone_number
string
true
The phone number of the user.
country
integer
true
The ID of the selected country.
city
integer
true
The ID of the selected city.
township
integer
true
The ID of the selected township.
district
integer
false
The ID of the selected district.
postcode
string
false
Postcode of the address.
line
string
true
Address details.
notes
string
false
User's notes about the address.
identity_number
string
false
The user's identity number.
primary
boolean
false
Indicates if this is the primary address.
is_corporate
boolean
false
Indicates if this is a corporate address.
company_name
string
false
Company name if it is a corporate address.
tax_no
string
false
Tax number if it is a corporate address.
tax_office
string
false
Tax office if it is a corporate address.
e_bill_taxpayer
boolean
false
Indicates if it is an e-bill taxpayer address.
Example Request
Example Response (201 Created)
Response Status Codes
201 Created
: The address was successfully created.400 Bad Request
: The request was malformed or missing required parameters.401 Unauthorized
: The user is not authorized to perform this action.429 Too Many Requests
: The request limit has been exceeded.500 Internal Server Error
: An unexpected error occurred on the server.
GET
User Address List
GET
User Address ListRetrieves a list of all addresses associated with the authenticated user.
Path: https://{storefront_url}/address/detailed/
Headers:
Authorization: Token <token>
Example Request
Example Response (200 OK)
Response Status Codes
200 OK
: The list of addresses was successfully retrieved.400 Bad Request
: The request was malformed or missing required parameters.401 Unauthorized
: The user is not authorized to perform this action.429 Too Many Requests
: The request limit has been exceeded.500 Internal Server Error
: An unexpected error occurred on the server.
GET
Single User Address
GET
Single User AddressRetrieves information about a specific address associated with the authenticated user.
Path: https://{storefront_url}/address/<address-id>/
Headers:
Authorization: Token <token>
Example Request
Example Response (200 OK)
Response Status Codes
200 OK
: The address details were successfully retrieved.400 Bad Request
: The request was malformed or missing required parameters.401 Unauthorized
: The user is not authorized to perform this action.429 Too Many Requests
: The request limit has been exceeded.500 Internal Server Error
: An unexpected error occurred on the server.
GET
Single User Address Detailed
GET
Single User Address DetailedRetrieves detailed information about a specific address associated with the authenticated user.
Path: https://{storefront_url}/address/<address-id>/detailed/
Headers:
Authorization: Token <token>
Example Request
Example Response (200 OK)
Response Status Codes
200 OK
: The address details were successfully retrieved.400 Bad Request
: The request was malformed or missing required parameters.401 Unauthorized
: The user is not authorized to perform this action.429 Too Many Requests
: The request limit has been exceeded.500 Internal Server Error
: An unexpected error occurred on the server.
PUT
Update User Address
PUT
Update User AddressUpdates a specific address associated with the authenticated user.
Path: https://{storefront_url}/address/<address-id>/
Headers:
Authorization: Token <token>
Body Parameters
title
string
true
Title of the address.
first_name
string
true
The first name of the user.
last_name
string
true
The last name of the user.
phone_number
string
true
The phone number of the user.
country
integer
true
The ID of the selected country.
city
integer
true
The ID of the selected city.
township
integer
true
The ID of the selected township.
district
integer
false
The ID of the selected district.
postcode
string
false
Postcode of the address.
line
string
true
Address details.
notes
string
false
User's notes about the address.
identity_number
string
false
The user's identity number.
primary
boolean
false
Indicates if this is the primary address.
is_corporate
boolean
false
Indicates if this is a corporate address.
company_name
string
false
Company name if it is a corporate address.
tax_no
string
false
Tax number if it is a corporate address.
tax_office
string
false
Tax office if it is a corporate address.
e_bill_taxpayer
boolean
false
Indicates if it is an e-bill taxpayer address.
Example Request
Example Response (200 OK)
Response Status Codes
200 OK
: The address was successfully updated.400 Bad Request
: The request was malformed or missing required parameters.401 Unauthorized
: The user is not authorized to perform this action.429 Too Many Requests
: The request limit has been exceeded.500 Internal Server Error
: An unexpected error occurred on the server.
PATCH
Partial Update User Address
PATCH
Partial Update User AddressPartially updates a specific address associated with the authenticated user.
Path: https://{storefront_url}/address/<address-id>/
Headers:Authorization: Token <token>
Body Parameters
title
string
true
Title of the address.
first_name
string
true
The first name of the user.
last_name
string
true
The last name of the user.
phone_number
string
true
The phone number of the user.
country
integer
true
The ID of the selected country.
city
integer
true
The ID of the selected city.
township
integer
true
The ID of the selected township.
district
integer
false
The ID of the selected district.
postcode
string
false
Postcode of the address.
line
string
true
Address details.
notes
string
false
User's notes about the address.
identity_number
string
false
The user's identity number.
primary
boolean
false
Indicates if this is the primary address.
is_corporate
boolean
false
Indicates if this is a corporate address.
company_name
string
false
Company name if it is a corporate address.
tax_no
string
false
Tax number if it is a corporate address.
tax_office
string
false
Tax office if it is a corporate address.
e_bill_taxpayer
boolean
false
Indicates if it is an e-bill taxpayer address.
Example Request
Example Response (200 OK)
Response Status Codes
200 OK
: The address was successfully updated.400 Bad Request
: The request was malformed or missing required parameters.401 Unauthorized
: The user is not authorized to perform this action.429 Too Many Requests
: The request limit has been exceeded.500 Internal Server Error
: An unexpected error occurred on the server.
DELETE
Delete User Address
DELETE
Delete User AddressDeletes a specific address associated with the authenticated user.
Path: https://{storefront_url}/address/<address-id>/
Headers:Authorization: Token <token>
Example Request
Example Response (204 No Content)
If the request is processed successfully, the response is shown with code 204 and the address is deleted. If the request fails, an appropriate error code along with an error message is returned.
Response Status Codes
204 No Content
: The address was successfully deleted.400 Bad Request
: The request was malformed or missing required parameters.401 Unauthorized
: The user is not authorized to perform this action.429 Too Many Requests
: The request limit has been exceeded.500 Internal Server Error
: An unexpected error occurred on the server.
GET
Address Country
GET
Address CountryThis endpoint is used to list all available countries.
Path: https://{storefront_url}/address/country/
Example Request
Example Response (200 OK)
Response Status Codes
200 OK
: The request was successful, and the requested resource is returned in the response.400 Bad Request
: The request was malformed or contained invalid parameters.401 Unauthorized
: The user is not authorized to access the requested resource.429 Too Many Requests
: The request rate limit has been exceeded.500 Internal Server Error
: An unexpected error occurred on the server.
GET
Address City
GET
Address CityThis endpoint is used to list all cities for a specified country.
Path: https://{storefront_url}/address/address/city/
Request Parameters
country
id
The ID of the country.
Example Request
Example Response (200 OK)
Response Status Codes
200 OK
: The request was successful, and the requested resource is returned in the response.400 Bad Request
: The request was malformed or contained invalid parameters.401 Unauthorized
: The user is not authorized to access the requested resource.429 Too Many Requests
: The request rate limit has been exceeded.500 Internal Server Error
: An unexpected error occurred on the server.
GET
Address Township
GET
Address TownshipThis endpoint is used to list all townships for a specified city.
Path: https://{storefront_url}/address/address/township/
Request Parameters
city
id
The ID of the city.
Example Request
Example Response (200 OK)
Response Status Codes
200 OK
: The request was successful, and the requested resource is returned in the response.400 Bad Request
: The request was malformed or contained invalid parameters.401 Unauthorized
: The user is not authorized to access the requested resource.429 Too Many Requests
: The request rate limit has been exceeded.500 Internal Server Error
: An unexpected error occurred on the server.
GET
Address District
GET
Address DistrictThis endpoint is used to list all districts for a specified township.
Path: https://{storefront_url}/address/address/district/
Request Parameters
township
id
The ID of the township.
Example Request
Example Response (200 OK)
Response Status Codes
200 OK
: The request was successful, and the requested resource is returned in the response.400 Bad Request
: The request was malformed or contained invalid parameters.401 Unauthorized
: The user is not authorized to access the requested resource.429 Too Many Requests
: The request rate limit has been exceeded.500 Internal Server Error
: An unexpected error occurred on the server.
Was this helpful?