Skip to content

Add an Item

Definition

POST /apis/v2/{SERVICE_ID}/item

Description

Create a new item.

Permissions

The user needs to have the permissions:

SERVICE_ID=read && SERVICE_ID=edit

To add an item, the user needs to have the associated Application Publisher Profile.

Parameters

The body parameter is a service’s item.

The new item must validate the service’s items rules.

The name, the application key, the English description field and the content mode are mandatory. By default, the content mode should be set to NONE.

The fields lastModifiedBy, lastModifiedDate and the revisionId are set server side. They don’t need to be part of the request parameters.

Example:

{
    "appKey" : "",
    "contentMode" : "NONE",
    "description" : { "EN": "The data model to check the structure of a tank alert." },
    "name" : "Tank Alert",
    "schema": "<xml></xml>"
}

Response

HTTP code Reason
200 Success
400 Invalid parameter count or content
403 Unauthorized
500 Unexpected exception

When the query is successful, the HTTP response is a 200 OK and returns the facade of the new item:

{
    "appKey" : "",
    "name" : "Tank Alert",
    "description" : "The data model to check the structure of a tank alert.",
    "calculatedContentMode" : "EDITABLE",
    "appInfo" : "",
    "lastModifiedBy" : "roxane.mace@amalto.com",
    "lastModifiedDate" : 1520863555978,
    "revisionId" : "89dca4833be67b44dae074fee84cc49c"
}

If the request parameter is null, the HTTP response is a 400 Invalid parameter:

{
    "status": 400,
    "code": 400,
    "message": "Unexpected error adding the item in the configuration!",
    "link": null,
    "developerMessage": "Invalid parameter count or content: the item cannot be null.",
    "conflictInformation": null
}

If the user does not have the right permissions, the HTTP Response will be a 403 Unauthorized:

{
    "status": 403,
    "code": 403,
    "message": "Unexpected error adding the item in the configuration! Access to the item 'Tank Alert' is not authorized. You need to have the permission 'read'.",
    "link": null,
    "developerMessage": "Unauthorized: access to the item 'Tank Alert' is not authorized, permission 'read' is missing.",
    "conflictInformation": null
}