Flexigift Service API

Create a User

The Create a User service injects a new user into the system.

URL

{base_url}/users

HTTP method

POST

Request headers

None

Request parameters

None

Request data

Name Type Mandatory? Constraints Notes
user_id string yes Must be unique. Unique ID.
amazon_id string yes - The user’s Amazon account ID.
name string yes - The user’s full name.
email string yes Must contain an ‘@’ symbol. The user’s email address.
gift_cards string[] no - Array of gift cards associated with the user.

Response data

A successful request returns the data you submitted plus a unique id:

Name Type Mandatory? Constraints Notes
id int yes - Unique internal ID generated by the system.
user_id string yes - -
amazon_id string yes - -
name string yes - -
email string yes - -
gift_cards string[] yes - -

HTTP response codes

Code Description Notes
201 Created -

Example request and response

Request:

curl -XPOST -H "Content-type: application/json" -d '  {
    "user_id": "user005",
    "amazon_id": "amz09876",
    "name": "Steve Stevens",
    "email": "steve.stevens@example.com", 
    "gift_cards": [
    	"gap-gc-005", 
    	"hanes-gc-002"
    ]
  }' 'http://localhost:3000/users'

Response:

{
  "user_id": "user005",
  "amazon_id": "amz09876",
  "name": "Steve Stevens",
  "email": "steve.stevens@example.com",
  "gift_cards": [
    "gap-gc-005",
    "hanes-gc-002"
  ],
  "id": 6
}