Client SDKs

Using cURL

In this example we are using the UNIX curl command line tool to demonstrate how to invoke remote operations.

In a Windows environment, Nuxeo recommends to use cygwin shell to avoid all formatting request issue using default shell like Powershell

  1. Here is how to create a new File document type on the Nuxeo demo instance, right under the default domain (you can copy, paste and test):

    curl -X POST -H "Content-Type: application/json" -u Administrator:Administrator -d '{ "entity-type": "document", "name":"newDoc", "type": "File","properties": { "dc:title": "Specifications", "dc:description": "Created via a so cool and simple REST API", "common:icon": "/icons/file.gif", "common:icon-expanded": null, "common:size": null}}' https://nightly.nuxeo.com/nuxeo/api/v1/path/default-domain
    
  2. You can get the new resource doing a standard GET (actually the JSON object was already returned in previous response):

    curl -X GET -u Administrator:Administrator  http://nightly.nuxeo.com/nuxeo/api/v1/path/default-domain/newDoc
    
  3. Now, "lock" this document we have just created by calling an Automation operation from command API on the document resource.

    curl -X POST -H "Content-Type: application/json+nxrequest"   -u Administrator:Administrator -d '{"params":{}}'  https://nightly.nuxeo.com/nuxeo/api/v1/path/default-domain/newDoc/@op/Document.Lock
    

    Pay attention to the Content-Type that is specific when using the @op adapter.

    You can check the result of your request on the web app (https://nightly.nuxeo.com/nuxeo/nxpath/[email protected]_domains, credentials:  Administrator/Administrator).

  4. You can also directly call an automation operation or chain, from the "Command endpoint". Here we return all the worskpaces of the demo.nuxeo.com instance:

    curl -H 'Content-Type:application/json+nxrequest' -X POST -d '{"params":{"query":"SELECT * FROM Document WHERE ecm:primaryType=\"Workspace\""},"context":{}}'   -u Administrator:Administrator https://nightly.nuxeo.com/nuxeo/api/v1/automation/Document.Query
    

3 months ago manonlumeau Remove updated review date
2 years ago Benoit Delbosc 17 | ix the Lock url by adding a missing "/
5 years ago Laurent Doguin 16
5 years ago Solen Guitter 15
5 years ago Vladimir Pasquier 14
5 years ago Solen Guitter 13
6 years ago Arnaud Kervern 11
6 years ago Arnaud Kervern 12 | Migrated to Confluence 4.0
7 years ago Bogdan Stefanescu 10 | example is not working when using '*' - server side exception
8 years ago Stéfane Fermigier 9
8 years ago Stéfane Fermigier 8
8 years ago Stéfane Fermigier 6
8 years ago Stéfane Fermigier 7
8 years ago Stéfane Fermigier 5
8 years ago Bogdan Stefanescu 4
8 years ago Bogdan Stefanescu 3
8 years ago Bogdan Stefanescu 2
8 years ago Bogdan Stefanescu 1
History: Created by Bogdan Stefanescu

We'd love to hear your thoughts!

All fields required