Search the Omeda Knowledge Base

< All Topics
Print

Assign Behavior To Category

Summary

This API provides the ability to assign a Behavior to a Behavior Category.

General Technical Requirements

The following technical requirements apply to all requests for this API.

HTTP Headers

The HTTP header must contain the following elements: x-omeda-appid a unique id provided to you by Omeda to access your data. The request will fail without a valid id.content-typea content type supported by this resource. See Supported Content Types for more details. If omitted, the default content type is application/json.

Content Type

If omitted, the default content type is application/json.JSONapplication/json

JSON is the preferred data exchange format, because it is lightweight and, in most cases, faster to process and utilizes less bandwidth. There are many available open-source JSON libraries available. See json.org for details.

Supported HTTP Methods

  1. POST : for creating a new Behavior Category

Field Definition

The following tables describe the data elements present on the requests and responses from the API. In addition to the below elements, a SubmissionId element will also be returned with all responses. This is a unique identifier for the web services response. It can be used to cross-reference the response in Omeda’s database.

Behavior Category Elements

Element NameData TypeDescription
BehaviorIdIntegerBehavior Identifier
BehaviorCategoryIdInteger ArrayBehavior Category Identifier
AppendbooleanIf you send in “Append”: true, the service will add the Behavior to the already existing list of Behaviors assigned to the Category. If you send in “Append”: false, the current Behavior/Category assignments will be cleared and replaced with what is passed into “BehaviorCategoryId”.

Assign Behavior to a Category/Categories

An HTTP POST assigns a Behavior to a Category or Categories. If you send in “Append”: true, the service will add the Behavior to the already existing list of Behaviors assigned to the Category. If you send in “Append”: false, the current Behavior/Category assignments will be cleared and replaced with what is passed into “BehaviorCategoryId”. See W3C’s POST specsfor details.

Request URI

For Production: https://ows.omeda.com/webservices/rest/brand/{brandAbbreviation}/behavior/category/assignment/*

For Testing: https://ows.omedastaging.com/webservices/rest/brand/{brandAbbreviation}/behavior/category/assignment/*

Request

POST requests, by their nature, will not have an Id element, since POST is reserved for creating new elements, and the service governs the allocation of ids.

Example Request

{ 
  "BehaviorId": 8923089,
  "BehaviorCategoryId": [3489,3871,39078,2982],
  "Append": true
}

Response – Success

Upon successful creation of a Behavior Category or Categories, a HTTP 200 will be issued. The response has a ResponseInfo element with one sub-element, a BehaviorCategoryIdelement, which is the Id for the Behavior Category.

HTTP Response Codes

StatusDescription
200 OKThe request has succeeded.

Example Response

“Append” : true

{
  "SubmissionId" : "C95AE90C-BEC6-41F2-91E2-2BA9168D1D1F",
  "ResponseInfo":[
    {
      "Message":"3 Categories have been appended to BehaviorId 782378"
    }
  ]
}

“Append” : false

{
  "SubmissionId" : "C95AE90C-BEC6-41F2-91E2-2BA9168D1D1F",
  "ResponseInfo":[
    {
      "Message":"Existing categories have been cleared.  3 Categories have been added to BehaviorId 782378"
    }
  ]
}

Response – Failure

If an error occurs repeatedly, please contact your Omeda representative.

HTTP Response Codes

StatusDescription
400 Bad RequestTypically, this error occurs when the request does not follow the specifications.
403 ForbiddenTypically, this error occurs when the credentials are erroneous. Potentially, an incorrect x-omeda-appid.
404 Not FoundTypically, this error occurs with a malformed URL or the resource that is searched for is not found.
405 Method Not AllowedTypically, this error occurs when the resource accessed is not allowed by the HTTP Method utilized. Make sure you employ the correct HTTP Method (POST) for this request.
500 Internal Server ErrorIn the rare case that there is a server-side problem, this response will be returned. This generally indicates a problem of a more serious nature, and submitting additional requests may not be advisable. Please contact Omeda Account Representative.

Example Response

{
  "SubmissionId" : "C95AE90C-BEC6-41F2-91E2-2BA9168D1D1F",
  "Errors" : [
    {
      "Error": "BehaviorCategoryId 3873978 is already assigned to BehaviorId 737893"
    }
  ]
}

Possible Error Messages

In the event of an error, an error response will be returned. Here are some of the possible responses you might receive.

BehaviorCategoryId {BehaviorCategoryId} is already assigned to BehaviorId {BehaviorId}
Tags:
Table of Contents
Scroll to Top