Address Screen

This API is used for viewing, editing, deleting, adding and set default address.

Address APIs

The Address APIs handle the management of user addresses on the e-commerce platform, allowing users to create, update, view, and set default shipping addresses.

Address listing and adding screens

1. Create Address API

The Create Address API enables users to add a new address to their account.

Endpoint

  • {{baseurl}}/api/v1/customer/create-address

Method:

  • POST

Request Parameters:

None

Request Body:

address: The complete address details, including street, city, postal code, etc.

  • address_type: The type of address (e.g., Home, Work, etc.).

  • landmark: A landmark or notable location near the address.

  • is_default: A boolean flag indicating whether this address is the default shipping address for the user.

  • level_id: The unique identifier of the address level.

Authorization:

The API requires a bearer token in the request header for authentication. Users must include their valid bearer token in the "Authorization" header of the HTTP request to add a new address.

Response Format:

The API responds with a JSON object indicating the status of the address creation request.

2. Update Address API

The Update Address API allows users to modify an existing address in their account.

Endpoint

  • {{baseurl}}/api/v1/customer/update-address

Method

  • POST

Request Parameters:

None

Request Body:

The request body should include the following parameters to update an address:

  • address_id: The unique identifier of the address to be updated.

  • address: The updated complete address details, including street, city, postal code, etc.

  • address_type: The updated type of address (e.g., Home, Work, etc.).

  • landmark: The updated landmark or notable location near the address.

  • is_default: The updated boolean flag indicating whether this address is the default shipping address for the user.

  • level_id: The updated unique identifier of the address level.

Authorization:

The API requires a bearer token in the request header for authentication. Users must include their valid bearer token in the "Authorization" header of the HTTP request to update an address.

Response Format:

The API responds with a JSON object indicating the status of the address update request.

3. List Addresses API

The List Addresses API retrieves a paginated list of all addresses associated with the authenticated user.

Endpoint

  • {{baseurl}}/api/v1/customer/address?page=1

Method:

  • GET

Request Parameters:

  • page (optional): The page number for paginated results. If not specified, the first page of addresses will be returned.

Request Body:

None

Authorization:

The API requires a bearer token in the request header for authentication. Users must include their valid bearer token in the "Authorization" header of the HTTP request to access their addresses.

Response Format:

The API responds with a JSON object containing the paginated list of addresses associated with the user's account.

4. Set Default Address API

The Set Default Address API allows users to set a specific address as their default shipping address.

Endpoint

  • {{baseurl}}/api/v1/customer/set-default-address/:address_id

Method

  • GET

Request Parameters:

  • address_id: The unique identifier of the address to be set as the default shipping address.

Request Body:

None

Authorization:

The API requires a bearer token in the request header for authentication. Users must include their valid bearer token in the "Authorization" header of the HTTP request to set a default address.

Response Format:

The API responds with a JSON object indicating the status of the default address update request.

5. Shipping Level API

The Shipping Level API retrieves a list of shipping levels available on the e-commerce platform.

Endpoint

  • {{baseurl}}/api/v1/shipping?lang_code=en

Method

  • GET

Request Parameters:

  • lang_code (optional): The language code used to retrieve shipping level names and descriptions in a specific language. If not provided, the default language will be used.

Request Body:

None

Authorization:

The API requires a bearer token in the request header for authentication. Users must include their valid bearer token in the "Authorization" header of the HTTP request to access their addresses

Response Format:

The API responds with a JSON object containing the list of available shipping levels.

6. Delete Address API

The Delete Address API allows users to remove a specific address from their account.

Endpoint

  • {{baseurl}}/api/v1/customer/delete-address/:address_id

Method

  • GET

Request Parameters:

  • address_id: The unique identifier of the address to be deleted.

Request Body:

None

Authorization:

The API requires a bearer token in the request header for authentication. Users must include their valid bearer token in the "Authorization" header of the HTTP request to delete an address.

Response Format:

The API responds with a JSON object indicating the status of the address deletion request.

Features:

  • The Create Address API allows users to add a new address to their account.

  • The Update Address API enables users to modify an existing address in their account.

  • The List Addresses API provides users with a paginated view of all addresses associated with their account.

  • The Set Default Address API allows users to set a specific address as their default shipping address.

  • The Shipping Level API retrieves a list of available shipping levels.

Usage:

  • The Create Address API is used when users want to add a new address to their profile, such as a new home or work address.

  • The Update Address API is called when users need to update an existing address due to changes in location or other details.

  • The List Addresses API is used to display all the addresses associated with the user's account, allowing them to manage and view their address book.

  • The Set Default Address API is called when users want to set a specific address as their default shipping address for convenient checkout.

  • The Shipping Level API is used to fetch available shipping options during the checkout process, giving users choices for delivery.

Last updated