# Assignment Resources

Manage Assignments

## Retrieving a list of categories for which the reference id is assigned

> Retrieves a list of categories for which the reference id is assigned.\
> \*\*\*\
> \### Additional scope info\
> \
> \* \`category.category\_read\_unpublished\` - Only required if the category has not been published.<br>

```json
{"openapi":"3.0.1","info":{"title":"Category","version":"0.0.1"},"tags":[{"name":"Assignment Resources","description":"Manage Assignments"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["category.category_read_unpublished"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"category.category_manage":"Manage a category","category.category_read_unpublished":"Read unpublished categories","category.category_publish":"Publish a category","category.category_unpublish":"Unpublish a category"}}}}},"schemas":{"Category":{"type":"object","description":"Definition of category","properties":{"id":{"type":"string","description":"Category unique identifier generated when the category is created."},"parentId":{"type":"string","description":"Unique identifier of the parent category. No parentId in the body indicates that this is a root category.","nullable":true},"localizedName":{"type":"object","additionalProperties":{"type":"string"},"description":"Localized category name as a map of translations."},"localizedDescription":{"type":"object","additionalProperties":{"type":"string"},"description":"Localized category description as a map of translations."},"localizedSlug":{"type":"object","additionalProperties":{"type":"string"},"description":"Provides localized category name or code without diacritics for the URL."},"name":{"type":"string","description":"Category name in tenant default language.","deprecated":true},"description":{"type":"string","description":"Description in tenant default language.","deprecated":true},"code":{"type":"string","description":"Unique category identifier defined by the tenant."},"ecn":{"type":"array","description":"List of external category numbers (ECNs) unique for each category.","items":{"type":"string"}},"validity":{"$ref":"#/components/schemas/Validity","description":"Category validity."},"position":{"type":"integer","format":"int32","description":"Category position relative to sibling categories."},"published":{"type":"boolean","description":"Flag indicating whether the category has been published."},"supercategoriesIds":{"type":"array","description":"IDs of supercategories.","items":{"type":"string"}},"ownClassificationMixins":{"type":"array","description":"List of classification mixins defined for this category.","items":{"$ref":"#/components/schemas/OwnClassificationMixin"}},"classificationMixins":{"type":"array","description":"Combined list of classification mixins from parent categories and category's ownClassification mixins.","items":{"$ref":"#/components/schemas/ClassificationMixin"}},"mixins":{"type":"object","description":"Custom category attributes included directly in the mixins object."},"metadata":{"$ref":"#/components/schemas/MetadataResponse"},"media":{"type":"array","items":{"$ref":"#/components/schemas/Media"}}},"required":["id","localizedName","position","published","metadata","media"]},"Validity":{"type":"object","properties":{"from":{"type":"string","description":"Date and time from which the category is valid compliant with the ISO 8601 standard.","format":"date-time"},"to":{"type":"string","description":"Date and time to which the category is valid compliant with the ISO 8601 standard.","format":"date-time"}}},"OwnClassificationMixin":{"type":"object","properties":{"name":{"type":"string","description":"Name of the mixin.","pattern":"^[a-zA-Z0-9_]\\S*$"},"schemaUrl":{"type":"string","description":"URL of the mixin schema.","pattern":"^https?://[^\\s/$.?#].\\S*$"},"required":{"type":"boolean","description":"Indicates whether the mixin is required."}},"required":["name","schemaUrl"],"description":"Classification mixin defined for a given category."},"ClassificationMixin":{"type":"object","properties":{"name":{"type":"string","description":"Name of the mixin","pattern":"^[a-zA-Z0-9_]\\S*$"},"mixinPath":{"type":"string","description":"The mixins path that should be used when defining attributes on a product. It's built based on the following pattern - `class_<sourceCategory.code>_<name>`."},"schemaUrl":{"type":"string","description":"URL of the mixin schema.","pattern":"^https?://[^\\s/$.?#].\\S*$"},"required":{"type":"boolean","description":"Indicates whether the mixin is required."},"sourceCategoryId":{"type":"string","description":"Unique identifier of the category from which the mixin comes from. Can be this category ID or one of the parent categories IDs."}},"required":["name","schemaUrl"],"description":"Classification mixin with source category information."},"MetadataResponse":{"allOf":[{"type":"object","properties":{"createdAt":{"type":"string","description":"Timestamp indicating when the category was created compliant with the ISO 8601 standard.","format":"date-time"},"modifiedAt":{"type":"string","description":"Timestamp indicating when the category was last modified compliant with the ISO 8601 standard.","format":"date-time"}}},{"$ref":"#/components/schemas/MetadataUpdate"}]},"MetadataUpdate":{"allOf":[{"type":"object","properties":{"version":{"type":"integer","description":"Category version.","format":"int32"}}},{"$ref":"#/components/schemas/MetadataCreate"}]},"MetadataCreate":{"type":"object","properties":{"mixins":{"type":"object","additionalProperties":{"type":"string"},"description":"A key-value map, where key is a mixin name and value is a link to the mixin schema."}}},"Media":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier of media."},"url":{"type":"string","description":"Url of the file."},"contentType":{"type":"string","description":"Content type of the file."},"metadata":{"allOf":[{"$ref":"#/components/schemas/MediaMetadataQueryDocument"},{"description":"Metadata of the file."}]},"customAttributes":{"allOf":[{"$ref":"#/components/schemas/MediaCustomAttributesQueryDocument"},{"description":"Custom attributes of the file."}]}}},"MediaMetadataQueryDocument":{"type":"object","properties":{"createdAt":{"type":"string","description":"Timestamp indicating when the media was created compliant with the ISO 8601 standard.","format":"date-time"},"modifiedAt":{"type":"string","description":"Timestamp indicating when the media was modified compliant with the ISO 8601 standard.","format":"date-time"}},"description":"Metadata of the file."},"MediaCustomAttributesQueryDocument":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier of media's custom attributes."},"height":{"type":"integer","description":"Height of the media image.","format":"int32"},"width":{"type":"integer","description":"Width of the media image.","format":"int32"},"sizeKB":{"type":"number","description":"Size in kilobytes of the file.","format":"double"},"type":{"type":"string","description":"Mime type of the file."},"name":{"type":"string","description":"Name of the file."}},"description":"Custom attributes of the file."},"ErrorResponse":{"required":["code","details","message","status"],"type":"object","properties":{"resourceId":{"type":"string","nullable":true},"code":{"type":"integer","format":"int32"},"status":{"type":"string"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"string"}}}}}},"paths":{"/category/{tenant}/assignments/references/{referenceId}":{"get":{"tags":["Assignment Resources"],"summary":"Retrieving a list of categories for which the reference id is assigned","description":"Retrieves a list of categories for which the reference id is assigned.\n***\n### Additional scope info\n\n* `category.category_read_unpublished` - Only required if the category has not been published.\n","operationId":"GET-category-tree-list-categories-by-reference-id","parameters":[{"name":"tenant","in":"path","description":"Your Emporix tenant name.\n\n**Note**: The tenant should always be written in lowercase.\n","required":true,"schema":{"type":"string"}},{"name":"referenceId","in":"path","description":"Assignment reference unique identifier, for example: productId.\n","required":true,"deprecated":false,"allowEmptyValue":false,"allowReserved":false,"schema":{"type":"string"}},{"name":"showUnpublished","in":"query","description":"If set to `true`, resources assigned to not published categories are retrieved as well.\nPossible values:\n* `true`\n* `false`\n\n**Note**: To get unpublished categories you need to have `category.category_read_unpublished` scope.\n","schema":{"type":"boolean","default":false}},{"name":"expandSupercategoriesIds","in":"query","description":"If set to `true`, each entry is enriched with `supercategoriesIds` field containing supercategories ids.\nPossible values:\n* `true`\n* `false`\n","schema":{"type":"boolean","default":false}},{"name":"pageNumber","in":"query","description":"Page number to be retrieved. The number of the first page is 1.\n**Note**: If the `pageNumber` parameter is passed, size of the pages must be specified in the `pageSize` parameter.\n","schema":{"minimum":1,"type":"integer","format":"int32","default":1}},{"name":"pageSize","in":"query","description":"Number of export files to be retrieved per page.\n","schema":{"minimum":1,"type":"integer","format":"int32","default":60}},{"name":"sort","in":"query","description":"List of properties used to sort the results, separated by commas. This list is validated against available fields. Sorting by deprecated field is forbidden.\nPossible values:\n* `{fieldName}:ASC`\n* `{fieldName}:DESC`\n* `{fieldName}:ASC,{fieldName2}:DESC`\n* `{internationalizedFieldName.en}:ASC` - contains localized field name and extension. Valid only if Accepted-language header contains this extension and it is supported by configuration of the tenant. If all language are accepted (Accept-language='*') then extension must exist in tenant configuration. No other sorting are allowed for this specific internationalized field.\n* `{internationalizedFieldName}:ASC` - contains only localized field name. Extension will be deducted based on Accept-language header. If all language are accepted (Accept-language='*') then extension is taken from tenant configuration and is equal to default language. In other case the language with highest priority is taken. No other sorting are allowed for this specific localized field.\n","schema":{"type":"string"}},{"name":"Accept-Language","in":"header","description":"List of properties used to project and sort the results, separated by commas.\nPossible values:\n* `*` - each internationalized field is returned as a map containing all available (specified in tenant configuration) translations. This is also the default behaviour if the header is not set.\n* `en`, `en,de` - each internationalized field is returned as a map containing translation specified by a header value. If translation is not supported by tenant configuration then exception is thrown. First language is the one with highest priority.\n* `fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5` - each internationalized field is returned as a map containing translation specified by a header value. If translation is not supported by tenant configuration then exception is thrown.\n","schema":{"type":"string","default":"*"}},{"name":"X-Version","in":"header","description":"To use this endpoint you have to add `X-Version` header with proper value to your request.\n\n**Note**: The header value has to match following regular expression: `^v[1-9][0-9]?$`\n","required":true,"schema":{"pattern":"^v[1-9][0-9]?$","type":"string"}},{"name":"X-Total-Count","in":"header","description":"The header value indicates if the total count of entities should be returned.\nPossible values:\n* `true`\n* `false`\nDefault value: `false`\n","schema":{"type":"boolean","default":false}}],"responses":{"200":{"description":"The request was successful. The categories for given reference id are returned.","headers":{"X-Total-Count":{"description":"Total amount of categories to which resource id is assigned.","schema":{"type":"integer","format":"int32"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Category"}}}}},"400":{"description":"Request was syntactically incorrect. Details will be provided in the response payload","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Permission denied due to insufficient rights. This may happen when request does not contain sufficient scopes for given query values.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Reference with the specified reference id does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Deleting all assignments by referenceId

> Deletes all assignments for a specified referenceId, e.g. all assignments for a given productId.<br>

```json
{"openapi":"3.0.1","info":{"title":"Category","version":"0.0.1"},"tags":[{"name":"Assignment Resources","description":"Manage Assignments"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["category.category_manage"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"category.category_manage":"Manage a category","category.category_read_unpublished":"Read unpublished categories","category.category_publish":"Publish a category","category.category_unpublish":"Unpublish a category"}}}}},"schemas":{"Object":{"type":"object"},"ErrorResponse":{"required":["code","details","message","status"],"type":"object","properties":{"resourceId":{"type":"string","nullable":true},"code":{"type":"integer","format":"int32"},"status":{"type":"string"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"string"}}}}}},"paths":{"/category/{tenant}/assignments/references/{referenceId}":{"delete":{"tags":["Assignment Resources"],"summary":"Deleting all assignments by referenceId","description":"Deletes all assignments for a specified referenceId, e.g. all assignments for a given productId.\n","operationId":"DELETE-category-tree-remove-all-assignments","parameters":[{"name":"tenant","in":"path","description":"Your Emporix tenant name.\n\n**Note**: The tenant should always be written in lowercase.\n","required":true,"schema":{"type":"string"}},{"name":"referenceId","in":"path","description":"Assignment reference unique identifier, for example: productId.\n","required":true,"deprecated":false,"allowEmptyValue":false,"allowReserved":false,"schema":{"type":"string"}},{"name":"X-Version","in":"header","description":"To use this endpoint you have to add `X-Version` header with proper value to your request.\n\n**Note**: The header value has to match following regular expression: `^v[1-9][0-9]?$`\n","required":true,"schema":{"pattern":"^v[1-9][0-9]?$","type":"string"}}],"responses":{"204":{"description":"Assignments has been successfully deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Object"}}}},"403":{"description":"Permission denied due to insufficient rights. This may happen when request does not contain sufficient scopes for given query values.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Assignment with given referenceId does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```
