create_category
4 min
creates an email category in a project the folder that templates are grouped under if a category with the same title already exists in that project, the existing one is returned and no duplicate is create basic structure each call to the api requires action and a group id name type required description action string true for this call, create category group id integer true this designates which project the category belongs to the api id in the header must be part of the organization that owns the group doc array true see doc parameters below cat name string true the category title doc parameters name type required description cat name string true the category title example call curl x post "https //www regpack com/reg/api2/emails/" \\ h "content type application/json" \\ h "accept application/json" \\ h "api id 15263" \\ h "api user api admin\@regpacks com" \\ h "api token cd2e514f 7gab 3cde 62fg 51abcd4e7362" \\ d '{ "action" "create category", "group id" 100909072, "doc" { "cat name" "registration emails" } }'import requests import json emails endpoint = "https //www regpack com/reg/api2/emails/" headers = { "content type" "application/json", "accept" "application/json", "api id" "15263", "api user" "api admin\@regpacks com", "api token" "cd2e514f 7gab 3cde 62fg 51abcd4e7362", } payload = { "action" "create category", "group id" 100909072, "doc" { "cat name" "registration emails", }, } create category json = json dumps(payload) create category response = requests post(url=emails endpoint, data=create category json, headers=headers, timeout=10) example response cat id is the associated category id that was created, and existed returns true if the category already existed { "success" true, "cat id" "112481", "existed" false }