Ingest API

Contents

A REST style api to create, read, update and delete documents. Use this to update documents in your collection(s) externally.

Endpoint

The API’s default location is:

localhost:8080/webapp/com.enonic.app.explorer/api/v2/documents

Production deployment

Use vhosts to deploy the API on a custom domain/URL.

com.enonic.xp.web.vhost.cfg
mapping.ingestApi.host = company.com
mapping.ingestApi.source = /ingest
mapping.ingestApi.target = /webapp/com.enonic.app.explorer/api/v2/documents

Using the vhost configuration above, the API will be available on company.com/ingest

Headers

The API requires that you create and submit a valid API key in the HTTP request header.

TODO: What about cty+accept?

Name Attributes Value Details

Accept

<optional>

application/json

What MIME-type the client wants in the response

Content-Type

<required>

application/json

What type of data is sent in the request body

Authorization

<required>

Explorer-Api-Key XXXX

A valid API key for the collection you want to get documents from.

API documentation

The API is documented through the bundled user interface aka client.

Visit the API URL to give it a spin:

REST client

Use the client by following the steps below:

Common variables

Specify the API key, and the collection to access. These values will automatically be applied to the different operations.

Bulk operations

You may perform the following bulk operations:

  • Get

  • Create or Modify

  • Delete

Single operations

Using a document’s URL you may perform the following operations:

  • Get

  • Patch - TODO? Modify?

  • Delete

Usage examples

Below are some examples of using the API via cURL:

Bulk get documents with id = 1 and 2
curl -XGET "http://localhost:8080/webapp/com.enonic.app.explorer/api/v2/documents/{collection}?id=1&id=2&returnMetadata=false" -H "authorization:Explorer-Api-Key {apikey}"
Delete a single document
curl -XDELETE "http://localhost:8080/webapp/com.enonic.app.explorer/api/v2/documents/{collection}/{documentId}" -H "authorization:Explorer-Api-Key {apiKey}"
Visit the API endpoint with your browser for a complete set of documentation.

Contents

Contents