Save user shipping address interface

Create or update the user's shipping address information.

Points to note

  • The API uses the POST method and requires data to be submitted in application/ format
  • Access requires user login
  • If an ID parameter is provided, the existing address will be updated; otherwise, a new address will be created
  • All fields marked as required must be provided with a value

Request address

{域名地址}/api/order/address

Description:{域名地址}Replace it with your domain name, such ashttps://en.anqicms.com/api/order/address

Request Syntax

POST {域名地址}/api/order/address
Content-Type: application/json

Request Headers

This interface also involves common request headers. For more information, please refer toCommon Request Headers (Common Request Headers).

Request parameters

Field name Type Required Description
id int No Address ID, for update operation if it exists
name string Is Recipient's name
last name string Is recipient's surname
email string Is Email address
company string No company name
phone string Is Contact phone number
Province string Is Province
City string Is City
Country string Is district
address information string Is detailed address
postal code string Is postal code

Response header

This interface only involves public response headers. For more information, please refer toCommon Request Headers (Common Request Headers).

Return parameters

Field name Type Description
code int Error code
msg string Error description
data object Saved address data

Data result parameter

Field name Type Description
id int Address ID
name string Recipient's name
last name string recipient's surname
email string Email address
company string company name
phone string Contact phone number
Province string Province
City string City
Country string district
address information string detailed address
postal code string postal code
created_time int Timestamp of creation
updated_time int update timestamp
user_id int User ID
status int Status (1: enabled, 0: disabled)

Usage Example

Request example (create a new address)

POST /api/order/address HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json

{
  "name": "王先生",
  "last_name": "王",
  "email": "[email protected]",
  "company": "示例公司",
  "phone": "13888888888",
  "province": "河南省",
  "city": "郑州市",
  "country": "中原区",
  "address_info": "中原西路233号",
  "postcode": "450000"
}

Request example (update an existing address)

POST /api/order/address HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json

{
  "id": 1,
  "name": "王先生",
  "last_name": "王",
  "email": "[email protected]",
  "company": "示例公司",
  "phone": "13888888888",
  "province": "河南省",
  "city": "郑州市",
  "country": "中原区",
  "address_info": "中原西路233号",
  "postcode": "450000"
}

Response Example

{
  "code": 0,
  "msg": "保存成功",
  "data": {
    "id": 1,
    "created_time": 1669212548,
    "updated_time": 1669212548,
    "user_id": 1000,
    "name": "王先生",
    "last_name": "王",
    "email": "[email protected]",
    "company": "示例公司",
    "phone": "13888888888",
    "province": "河南省",
    "city": "郑州市",
    "country": "中原区",
    "address_info": "中原西路233号",
    "postcode": "450000",
    "status": 1
  }
}

error code

Error code Description
0 OK
-1 Error, the reason is indicated in msg
1001 Not logged in
1002 Not authorized
200 API request OK