No effect after a document update with API REST

Bonjour

Je crée un document avec succès, selon la commande suivante

curl -X POST -H "Content-Type: application/json" -u "Administrator:Administrator" -d "{ \"entity-type\": \"document\", \"name\":\"MyDoc\", \"type\": \"SimpleDocument\", \"properties\": { \"dc:title\": \"MyDoc\", \"dc:description\": \"Created via a so cool and simple REST API\"}}" "http://localhost:8080/nuxeo/api/v1/path/IN2P3"

{"entity-type":"document","repository":"default","uid":"8283131e-d835-4648-9bac-6a662af950f5","path":"/IN2P3/MyDoc","type":"SimpleDocument","state":"project","versionLabel":"0.0","isCheckedOut":true,"title":"MyDoc","lastModified":"2014-03-28T20:54:35.64Z","facets":["Commentable","Versionable","Snapshotable","Publishable","HasRelatedText"],"changeToken":"1396040075645","contextParameters":{}}

alors je récupère l'UID du document créé et j'essaie de modifier le document selon la commande suivante:

set id="8283131e-d835-4648-9bac-6a662af950f5"

curl -X PUT -H "Content-Type: application/json+nxrequest" -H "X-NXDocumentProperties: *" -u "Administrator:Administrator" -d "{\"entity-type\": \"document\", \"repository\": \"default\", \"uid\":\"%id%\", \"properties\" : { \"dc:title\": \"toto\", \"dc:description\": \"Updated via a so cool and simple REST API\"}}" http://localhost:8080/nuxeo/api/v1/id/%id%

Ce que je constate: la version du document est incrémentée mais ni le titre ni la description ne sont modifiés.

Voici la relecture des propriétés du document:

curl -X GET -H "Content-Type: application/json+nxrequest" -H "X-NXDocumentProperties: *" -u "Administrator:Administrator" http://localhost:8080/nuxeo/api/v1/id/"8283131e-d835-4648-9bac-6a662af950f5"

{"entity-type":"document","repository":"default","uid":"8283131e-d835-4648-9bac-6a662af950f5","path":"/IN2P3/MyDoc","type":"SimpleDocument","state":"project","versionLabel":"0.2","isCheckedOut":false,"title":"MyDoc","lastModified":"2014-03-28T20:57:52.00Z","properties":{"uid:uid":null,"uid:minor_version":"2","uid:major_version":"0","dc:creator":"Administrator","dc:source":null,"dc:nature":null,"dc:contributors":["Administrator"],"dc:created":"2014-03-28T20:54:35.00Z","dc:description":"Created via a so cool and simple REST API","dc:rights":null,"dc:subjects":[],"dc:publisher":null,"dc:valid":null,"dc:format":null,"dc:issued":null,"dc:modified":"2014-03-28T20:57:52.00Z","dc:expired":null,"dc:coverage":null,"dc:language":null,"dc:title":"MyDoc","dc:lastContributor":"Administrator","files:files":[],"common:icon":"/img/page_white_text.png","common:icon-expanded":null,"common:size":null,"file:content":null,"file:filename":null,"DocumentSchema:EDMS_ID":null,"DocumentSchema:Domaine":null,"DocumentSchema:Atrium_ID":"ATRIUM-9","DocumentSchema:Fonction":null,"relatedtext:relatedtextresources":[]},"facets":["Commentable","Versionable","Snapshotable","Publishable","HasRelatedText"],"changeToken":"1396040272000","contextParameters":{}}

Qui peut m'expliquer l'erreur?

version du serveur: 5.8.0-HF09

système: windows 7

Merci Christian

0 votes

2 answers

1994 views

ANSWER



Hi,

use header Content-Type:application/json instead of Content-Type: application/json+nxrequest for your PUT request.

1 votes



Bonjour

Merci pour ce conseil qui a bien fonctionné!!

Christian

0 votes