Permalink
Fetching contributors…
Cannot retrieve contributors at this time
155 lines (138 sloc) 4.95 KB
title review labels confluence tree_item_index history
Using cURL
comment date status
2018-01-16
ok
content-review-lts2016
curl
client
rest-api
troger
excerpt
multiexcerpt
lts2017-ok
ajs-parent-page-id ajs-parent-page-title ajs-space-key ajs-space-name canonical canonical_source page_id shortlink shortlink_source source_link
16091040
Client SDKs
NXDOC
Nuxeo Platform Developer Documentation
Using+cURL
3343035
uwIz
/display/NXDOC/Using+cURL
800
author date message version
Benoit Delbosc
2016-10-07 12:55
ix the Lock url by adding a missing "/
17
author date message version
Laurent Doguin
2013-12-18 15:24
16
author date message version
Solen Guitter
2013-11-14 15:03
15
author date message version
Vladimir Pasquier
2013-10-23 14:30
14
author date message version
Solen Guitter
2013-08-30 15:08
13
author date message version
Arnaud Kervern
2012-09-03 16:55
Migrated to Confluence 4.0
12
author date message version
Arnaud Kervern
2012-09-03 16:55
11
author date message version
Bogdan Stefanescu
2011-06-23 18:31
example is not working when using '*' - server side exception
10
author date message version
Stéfane Fermigier
2010-08-03 15:11
9
author date message version
Stéfane Fermigier
2010-08-03 15:10
8
author date message version
Stéfane Fermigier
2010-08-03 14:11
7
author date message version
Stéfane Fermigier
2010-08-03 14:11
6
author date message version
Stéfane Fermigier
2010-08-03 14:10
5
author date message version
Bogdan Stefanescu
2010-07-19 12:16
4
author date message version
Bogdan Stefanescu
2010-07-19 12:15
3
author date message version
Bogdan Stefanescu
2010-07-19 12:08
2
author date message version
Bogdan Stefanescu
2010-07-19 11:55
1

{{! excerpt}}

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

{{! /excerpt}} {{#> callout type='warning' }}

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

{{/callout}}{{! multiexcerpt name='curl-examples'}}

  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/default@view_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
    

{{! /multiexcerpt}}