edit_category
This call edits a product category. The arguments that would be included in the doc are described below:
Basic parameters
Name | Type | Required | Description |
|---|---|---|---|
action | string | true | edit_category |
group_id | integer | true | This designates which project the action should be applied towards |
doc | array | true | See doc parameters below |
General Doc Parameters
Name | Type | Required | Description |
|---|---|---|---|
category_name | string | true | The name for the category visible to users |
category_id | integer | true | The id of the category you'd like to edit. These can be found in the top right of the edit window when editing a product in the backend of the system. |
category_top_remark | string | false | A brief description at the top of the category visible to users. An empty string will remove the existing remark. |
category_bottom_remark | string | false | A brief description at the bottom of the category visible to users. An empty string will remove the existing remark. |
category_quota_ordered | integer | false | The amount of products within a category that a user can order. The default has no limit. |
interchange_category | boolean | false | True if only a single product in the category should be able to be orderered. Default is False. |
mandatory_category | boolean | false | True if a product needs to be ordered from that category in order for the form to be marked complete. Default is False. |
Example
Edit an existing category
This is an example which would edit an existing category.
Call
import requests
import json
status_endpoint = https://www.regpack.com/reg/api2/products/
headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Api-Id": "15263",
"Api-user": "[email protected]",
"Api-Token": "cd2e514f-7gab-3cde-62fg-51abcd4e7362",
}
payload = {
"action": "create_category",
"group_id": 100909072,
"doc": {
"category_name": "Fall Performances",
"category_id": 251125,
"category_top_remark": "Fall Performances are below",
"category_bottom_remark": "Please note that if you must miss an event, tickets are only transferable to future performances",
"category_quota_ordered": 6,
"interchange_category": False,
"mandatory_category": False
}
}
create_category_json = json.dumps(payload)
create_category_response = requests.post(url=product_endpoint,
data=create_category_json,
headers=headers,
timeout=10)
Response
{
'success': true,
'doc': {
'cat_id': 251125,
'msg': 'Category updated successfully',
'msg_type': 'success'
}
}