JSON API » products » products/update

Updates an existing product.

Input parameters

Requires authentication and the commerce role privilege.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
idIntegerID of product to update.Yes
allowInteger1 to allow only direct customers to purchase this product, -1 to allow all customers recursively.NoCurrent value.
amountIntegerNumber of seconds for call time, or number of concurrent calls. Not used for type=product.NoCurrent value.
create_buyDecimalCost to reseller on purchase.NoCurrent value.
create_feeDecimalCost to customer on purchase.NoCurrent value.
currencyStringCurrency costs are in.NoCurrent value.
descriptionStringDescription.NoCurrent value.
informationStringInformation to provide customer before they purchase.NoCurrent value.
nameStringName.NoCurrent value.
periodStringHow often the period cost recurs. "monthly", "quarterly", "annually", or empty string for never. Not used for type=call_time.NoCurrent value.
period_buyDecimalCost to reseller each period. Not used for type=call_time.NoCurrent value.
period_feeDecimalCost to customer each period. Not used for type=call_time.NoCurrent value.
sharedInteger1 to share with all customers on system, 0 not to.NoCurrent value.
typeStringType. "call_time", "calls_in", "calls_in_out", "calls_in_out_total", "calls_in_total", "calls_out", "calls_out_total", "calls_total", or "product".NoCurrent value.
validationInteger1 to validate input then return, 0 for full action.No0

Responses

ProductDescription
201Input passed validation. Only returned if validation=1.
204Success.
400Invalid input parameters specified. Check the key and message fields for more details.
401The authentication details provided are invalid.
402Your role does not allow this.
404The 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

VersionChanges
4.0allow input parameter added.
3.13Function added.