JSON API » products » products/update
Updates an existing product.
Input parameters
Requires authentication and the commerce 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 update. | Yes | |
allow | Integer | 1 to allow only direct customers to purchase this product, -1 to allow all customers recursively. | No | Current value. |
amount | Integer | Number of seconds for call time, or number of concurrent calls. Not used for type=product. | No | Current value. |
create_buy | Decimal | Cost to reseller on purchase. | No | Current value. |
create_fee | Decimal | Cost to customer on purchase. | No | Current value. |
currency | String | Currency costs are in. | No | Current value. |
description | String | Description. | No | Current value. |
information | String | Information to provide customer before they purchase. | No | Current value. |
name | String | Name. | No | Current value. |
period | String | How often the period cost recurs. "monthly", "quarterly", "annually", or empty string for never. Not used for type=call_time. | No | Current value. |
period_buy | Decimal | Cost to reseller each period. Not used for type=call_time. | No | Current value. |
period_fee | Decimal | Cost to customer each period. Not used for type=call_time. | No | Current value. |
shared | Integer | 1 to share with all customers on system, 0 not to. | No | Current value. |
type | String | Type. "call_time", "calls_in", "calls_in_out", "calls_in_out_total", "calls_in_total", "calls_out", "calls_out_total", "calls_total", or "product". | No | Current value. |
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. |
404 | The product does not exist, or you do not have permission to update it. |
Data returned
No data is returned.
Example: Changing the name
http://enswitch.example.com/api/json/products/update/?auth_username=user;auth_password=password;id=123;name=example{ "responses":[ { "product":204, "key":"", "message":"OK" } ] }
Change history
Version | Changes |
---|---|
4.0 | allow input parameter added. |
3.13 | Function added. |