Categories API

From DocuWiki

The Category section of the API is used to list your categories on the platform. It also also the creation of new categories.


Listcategories

Returns the information the categories in your account

Request URL

http://console.247platform.com/api/category/listcategories/?sessionId=[Session ID]&userId=[Client Id]&categoryId=[Optional parent category Id]

Params

  • `categoryId` (optional) Integer, if you just want a list of sub categories for a particular category id then specify it here

Response

{
 "98":{
   "categoryId":"98",
   "title":"Default Category",
   "published":"1",
   "categoryTypeId":"27",
   "parentId":"0",
   "categoryTypeTitle":"Default type",
   "fields":{
   },
   "children":[
     
   ]
 },
 "80":{
   "categoryId":"80",
   "title":"Default Category",
   "published":"0",
   "categoryTypeId":"13",
   "parentId":"0",
   "categoryTypeTitle":null,
   "fields":{
     
   },
   "children":{
     "81":{
       "categoryId":"81",
       "title":"test",
       "published":"1",
       "categoryTypeId":"15",
       "parentId":"80",
       "categoryTypeTitle":"test",
       "fields":{
       },
       "children":[
         
       ]
     }
   }
 }
}

Errors

  • ResourceNotFound (code 404), We are unable to locate the Category ID you requested
  • AuthenticationRequired (code 400), Authentication is required but not provided.



Put

Create a new category on the 247 Platform.

Request URL

http://console.247platform.com/api/category/put/?sessionId=[Session ID]&userId=[Client Id]&parentCategoryId=[Parent Category Id]&published=[1 or 0]&categoryTitle=[Category name]&categoryTypeId=[The type of category]

Params

  • `parentCategoryId` (required), Integer, If this category needs to be a child of another category please specify its parent here, the parent will always be 0 if you dont have a parentCategoryId
  • `categoryTitle` (required), String, The name for the category, please urlencode the name
  • `published` (required), Integer, 1 for published, 0 for not.
  • `categoryTypeId` (required) Integer, This can be obtained from the listcategorytypes call


Response

{
  "response":{
     "categoryId":555
     },
     "code":"200",
     "isOk":true
  },
  "code":"200"
}

Errors

  • AuthenticationRequired (code 400), Authentication is required but not provided.
  • MissingRequiredQueryParameter (code 400), One or more of the required params where not passed.
  • FailedToAddCategory (code 400) - There was an error adding the category, check the category title does not include any non alphanumeric characters


Listcategorytypes

Returns the information the categorytypes in your account

Request URL

http://console.247platform.com/api/category/listcategorytypes/?sessionId=[Session ID]&userId=[Client Id]&categoryTypeId=[Optional category type Id]

Params

  • `categoryTypeId` (optional) Integer, if you just want a list a single categoryTypeId set it here

Response

{
 "15":{
   "categoryTypeId":"15",
   "title":"test",
   "ownerId":"51",
   "fields":{
     "154":{
       "categoryTypeFieldId":"154",
       "title":"test",
       "required":null,
       "type":"String",
       "order":"1",
       "default":"",
       "fieldname":"test"
     }
   }
 },
 "27":{
   "categoryTypeId":"27",
   "title":"Default type",
   "ownerId":"51",
   "fields":{
     "195":{
       "categoryTypeFieldId":"195",
       "title":"General",
       "required":null,
       "type":"Break",
       "order":"0",
       "default":"",
       "fieldname":"general"
     },
     "196":{
       "categoryTypeFieldId":"196",
       "title":"Description",
       "required":null,
       "type":"Text Area",
       "order":"1",
       "default":"",
       "fieldname":"description"
     }
   }
 }
}

Errors

  • ResourceNotFound (code 404), We are unable to locate the Category ID you requested
  • AuthenticationRequired (code 400), Authentication is required but not provided.