JSON API » products » products/purchase
Purchases a product.
Input parameters
Requires authentication and the administrator role privilege.
Name | Type | Description | Required | Default value |
---|---|---|---|---|
auth_username | String | Authentication username. | Yes | |
auth_password | String | Authentication password. | Yes | |
id | Integer | ID of product to purchase. | Yes | |
customer | Integer | ID of customer to purchase for. | No | Customer of authentication user. |
quantity | Integer | Quantity to purchase. | No | 1 |
validation | Integer | 1 to validate input then return, 0 for full action. | No | 0 |
Responses
Product | Description |
---|---|
201 | Input passed validation. Only returned if validation=1. |
204 | Success. |
400 | Invalid input parameters specified. Check the key and message fields for more details. |
401 | The authentication details provided are invalid. |
402 | Your role does not allow this. |
Data returned
No data is returned.
Example: With required parameters
http://enswitch.example.com/api/json/products/purchase/?auth_username=user;auth_password=password;id=123{ "responses":[ { "product":204, "key":"", "message":"OK" } ] ] }
Change history
Version | Changes |
---|---|
3.13 | Function added. |