Skip to content

Update an Item

Definition

PUT /apis/v2/{SERVICE_ID}/item

Description

Update the content of a specific item.

Details:

This resource cannot be used to change the item’s name or application key.

Permissions

The user needs to have the permissions:

SERVICE_ID=read && SERVICE_ID=edit

To update an item, the user needs to have the associated Application Publisher Profile, if not the item’s content mode should be set to EDIT.

Parameters

The body parameter is a service’s item.

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

During the request, the lastModifiedDate and the revisionId are automatically updated, as is the lastModifiedBy if the user is not the last one who has updated the item.

If the revisionId sent is not the one saved in the database, it will create a merge conflict.

{
    "appKey" : "",
    "contentMode" : "NONE",
    "description" : { "EN": "b2box Configuration Model (formerly named .configuration)" },
    "lastModifiedBy" : "roxane.mace@amalto.com",
    "lastModifiedDate" : 1520595372482,
    "name" : "_configuration",
    "revisionId" : "2bfd604dfc3ed5df648dc67dab0b3dcd",
    "schema": "<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" attributeFormDefault=\"unqualified\"> [...]"
}

Response

HTTP code Reason
200 Success
400 Invalid parameter count or content
403 Unauthorized
404 Not found
409 Conflict
500 Unexpected exception

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

{
  "appKey" : "",
  "name" : "_configuration",
  "description" : "b2box Configuration Model (formerly named .configuration) UPDATED",
  "calculatedContentMode" : "EDITABLE",
  "appInfo" : "",
  "lastModifiedBy" : "franck.montaigne@amalto.com",
  "lastModifiedDate" : 1520867930714,
  "revisionId" : "dd24b5687b9770f2238b425b2a8d9d0c"
}

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

{
  "status": 400,
  "code": 400,
  "message": "Unexpected error updating 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 updating the item in the configuration! Access to the item '_configuration' is not authorized. You need to have the permission 'read'.",
  "link": null,
  "developerMessage": "Unauthorized: access to the item '_configuration' is not authorized, permission 'read' is missing.",
  "conflictInformation": null
}

If the original item is not found, it will return a 404 Not found:

{
  "status": 404,
  "code": 404,
  "message": "Unexpected error updating the item in the configuration! Item '_configuration' is not found.",
  "link": null,
  "developerMessage": "Not found: the item '_configuration' is not found.",
  "conflictInformation": null
}

If the item has been updated meanwhile, it will return a non-empty multi-error object with the HTTP Response 409 Conflict:

{
  "status": 409,
  "code": -1,
  "message": "Conflict on saving the item '_configuration'. This item has been modified by christopher.vuong@amalto.com at Mon Mar 12 15:18:50 GMT 2018 since this item was read.",
  "link": null,
  "developerMessage": null,
  "conflictInformation": [
    {
      "itemId": "_configuration",
      "lastAuthor": "christopher.vuong@amalto.com",
      "lastModificationDate": 1520867930714
    }
  ]
}