Category
This section covers endpoints used for fetching, creating & updating Category list and details.
GET/api/v1/category
Get Categories
This endpoint is used to get category list in a tree format. All the sub-categories are nested inside their respective parent categories.
Request Parameters
NA - No request parameters required for this endpoint
Sample Request
Request
GET
/api/v1/categorycurl --location '<api_url>/api/v1/category' \
--header 'Accept: text/plain' \
--header 'Authorization: bearer {{apiKey}}'
Response Model
Response
{
"statusCode": 200,
"status": "OK",
"error": null,
"errorId": null,
"message": null,
"messageCode": "OK",
"result": [
{
"id": "string",
"name": "string",
"subCategories": [
"string"
],
"description": "string",
"iId": 0
}
]
}
| Name | Type | Description |
|---|---|---|
| result | object | Contains the category object with all details |
| result.id | int | Category id |
| result.name | string | Category name |
| result.subCategories | array | List of sub-categories associated with item |
| result.description | string | Description of the category |
| result.iId | int | iId of the category |
POST/api/v1/category
Create Category
This endpoint is used to create a new category.
Request Parameters
| Name | Type | Description |
|---|---|---|
| categoryCode | string | Code of the category |
| categoryName | string | Name of the category |
| parentCategoryCode | string | Code of the parent category |
| productFamilyId | int | Id of the product family |
Sample Request
Request
POST
/api/v1/categorycurl --location --request POST '<api_url>/api/v1/category' \
--header 'Content-Type: application/json' \
--header 'Accept: text/plain' \
--header 'Authorization: {{apiKey}}'\
--data '{
"categoryCode": "string",
"categoryName": "string",
"parentCategoryCode": "string",
"productFamilyId": 0
}'
Response Model
Response
{
"isValid": true,
"message": "string",
"errors": [
"string"
],
"messageCode": "string",
"recordId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
| Name | Type | Description |
|---|---|---|
| isValid | boolean | Whether the transaction was successful or failure, true - Success, false - Failure |
| message | string | Message to display on frontend (if any) in case of errors/success |
| errors | array | List of error messages, if any |
| messageCode | string | Response message code |
| recordId | Guid | Record ID of the object updated / created |
GET/api/v1/category/{id}
Category Detail
This endpoint is used to get category details based on category id.
Request Parameters
| Name | Type | Description |
|---|---|---|
| id | Guid | Id of the category |
Sample Request
Request
POST
/api/v1/categorycurl --location --request POST '<api_url>/api/v1/category' \
--header 'Content-Type: application/json' \
--header 'Accept: text/plain' \
--header 'Authorization: {{apiKey}}'
Response Model
Response
{
"name": "string",
"image": "string",
"slug": "string",
"displayText": "string",
"isFeatured": true,
"isGenderSpecific": true,
"parentMenuId": "string",
"displayOrder": 0,
"customSetId": "string",
"tariffCode": "string",
"description": "string",
"metaTitle": "string",
"metaDescription": "string",
"metaKeywords": "string",
"subcategories": [
{
"parentCategoryCode": "string",
"categoryCode": "string",
"categoryName": "string",
"productFamilyId": 0
}
],
"canonicalTags": "string",
"parentId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"parent": "string",
"link": "string",
"hasCustomSlug": true,
"customSlug": "string",
"level": 0,
"hasChild": true,
"externalRefId": 0,
"categoryCode": "string",
"prodCount": 0,
"additionalInfo1": "string",
"additionalInfo2": "string",
"additionalInfo3": "string",
"additionalInfo4": "string",
"additionalInfo5": "string",
"productFamilyId": 0,
"files": [
{
"recordId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"mediaType": 0,
"name": "string",
"url": "string",
"altText": "string",
"isDefault": true,
"isActive": true,
"displayOrder": 0,
"previewUrl": "string",
"isMultiple": true,
"isInternal": true
}
]
}
| Name | Type | Description |
|---|---|---|
| name | string | Name of the category |
| image | string | Image of the category |
| slug | string | Slug of the category |
| displayText | string | Display text of the category |
| isFeatured | boolean | Whether category is featured or not |
| isGenderSpecific | boolean | Whether category is gender specific or not |
| parentMenuId | string | Parent menu id of the category |
| displayOrder | integer | Display order of the category |
| customSetId | string | Custom set id of the category |
| tariffCode | string | Tariff code of the category |
| description | string | Description of the category |
| metaTitle | string | Meta title of the category |
| metaDescription | string | Meta description of the category |
| metaKeywords | string | Meta keywords of the category |
| subcategories | List of Object | Sub-categories detail |
| subcategories.parentCategoryCode | string | Parent category code of the category |
| subcategories.categoryCode | string | Code of the category |
| subcategories.categoryName | string | Name of the category |
| subcategories.productFamilyId | integer | Product family id of the category |
| canonicalTags | string | Canonical tags of the category |
| parentId | string | Parent id of the category |
| parent | string | Parent of the category |
| link | string | Link of the category |
| customSlug | string | Custom slug of the category |
| level | integer | Level of the category |
| externalRefId | integer | External ref id of the category |
| categoryCode | string | Code of the category |
| prodCount | integer | Total product count of the category |
| additionalInfo1 | string | Additional info1 of the category |
| additionalInfo2 | string | Additional info2 of the category |
| additionalInfo3 | string | Additional info3 of the category |
| additionalInfo4 | string | Additional info4 of the category |
| additionalInfo5 | string | Additional info5 of the category |
| productFamilyId | integer | Product family id of the category |
| files | list of object | |
| files.recordId | string | Id of the file |
| files.mediaType | integer | Type of media, ex: 0 for Image, 1 for Video and 2 for PDF |
| files.name | string | Name of the file |
| files.url | string | Url of the file |
| files.altText | string | Alt text of the file |
| files.isDefault | boolean | Whether this file is default or not |
| files.isActive | boolean | Whether the file is active or not |
| files.displayOrder | integer | Display order of the file |
| files.previewUrl | string | Preview url of the file |
| files.isMultiple | boolean | Whether the file has got multiple files |
| files.isInternal | boolean | Whether the file is for internal purpose or not |
PUT/api/v1/category/{id}
Update category
This endpoint is used to update details for an existing category.
Request Parameters
| Name | Type | Description |
|---|---|---|
| name | string | Name of the category |
| image | string | Image of the category |
| slug | string | Slug of the category |
| displayText | string | Display text of the category |
| isFeatured | boolean | Whether category is featured or not |
| isGenderSpecific | boolean | Whether category is gender specific or not |
| parentMenuId | string | Parent menu id of the category |
| displayOrder | integer | Display order of the category |
| customSetId | string | Custom set id of the category |
| tariffCode | string | Tariff code of the category |
| description | string | Description of the category |
| metaTitle | string | Meta title of the category |
| metaDescription | string | Meta description of the category |
| metaKeywords | string | Meta keywords of the category |
| canonicalTags | string | Canonical tags of the category |
| parent | string | Parent of the category |
| link | string | Link of the category |
| customSlug | string | Custom slug of the category |
| level | integer | Level of the category |
| externalRefId | integer | External ref id of the category |
| categoryCode | string | Code of the category |
| prodCount | integer | Total product count of the category |
| additionalInfo1 | string | Additional info1 of the category |
| additionalInfo2 | string | Additional info2 of the category |
| additionalInfo3 | string | Additional info3 of the category |
| additionalInfo4 | string | Additional info4 of the category |
| additionalInfo5 | string | Additional info5 of the category |
| productFamilyId | integer | Product family id of the category |
| files | list of object | |
| files.recordId | string | Id of the file |
| files.mediaType | integer | Type of media, ex: 0 for Image, 1 for Video and 2 for PDF |
| files.name | string | Name of the file |
| files.url | string | Url of the file |
| files.altText | string | Alt text of the file |
| files.isDefault | boolean | Whether this file is default or not |
| files.isActive | boolean | Whether the file is active or not |
| files.displayOrder | integer | Display order of the file |
| files.previewUrl | string | Preview url of the file |
| files.isMultiple | boolean | Whether the file has got multiple files |
| files.isInternal | boolean | Whether the file is for internal purpose or not |
Sample Request
Request
PUT
/api/v1/category/:idcurl --location --request PUT '<api_url>/api/v1/category/{categoryId}' \
--header 'Content-Type: application/json' \
--header 'Accept: text/plain' \
--header 'Authorization: bearer {{api-key}}'\
--data '{
"name": "string",
"image": "string",
"slug": "string",
"displayText": "string",
"isFeatured": true,
"isGenderSpecific": true,
"parentMenuId": "string",
"displayOrder": 0,
"customSetId": "string",
"tariffCode": "string",
"description": "string",
"metaTitle": "string",
"metaDescription": "string",
"metaKeywords": "string",
"subcategories": [
{
"parentCategoryCode": "string",
"categoryCode": "string",
"categoryName": "string",
"productFamilyId": 0
}
],
"canonicalTags": "string",
"parentId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"parent": "string",
"link": "string",
"hasCustomSlug": true,
"customSlug": "string",
"level": 0,
"hasChild": true,
"externalRefId": 0,
"categoryCode": "string",
"prodCount": 0,
"additionalInfo1": "string",
"additionalInfo2": "string",
"additionalInfo3": "string",
"additionalInfo4": "string",
"additionalInfo5": "string",
"productFamilyId": 0,
"files": [
{
"recordId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"mediaType": 0,
"name": "string",
"url": "string",
"altText": "string",
"isDefault": true,
"isActive": true,
"displayOrder": 0,
"previewUrl": "string",
"isMultiple": true,
"isInternal": true
}
]
}'
Response Model
Response
{
"isValid": true,
"message": "string",
"errors": [
"string"
],
"messageCode": "string",
"recordId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
| Name | Type | Description |
|---|---|---|
| isValid | boolean | Whether the transaction was successful or failure, true - Success, false - Failure |
| message | string | Message to display on front end (if any) in case of errors/success |
| errors | array | List of error messages, if any |
| messageCode | string | Response message code |
| recordId | Guid | Record ID of the object updated / created |