Skip to main content
Version: 2.8

Sending conversion requests with new content specification

When you want to convert a content into new content (instead of a content representation), D1 REST API allows you to define the specification of the new content in the request message body, by passing the new content properties in the newContentSpecification object.

Task 1: Writing new content specification in JSON

Since the specification can include any content property, let's use the following criteria to create an example:

  • Source content must be converted to an image of the .png format.
  • Source content must be converted to a new content.
  • New content must be created in a specific folder.
  • New content must have a name.
  • New content must have a description.

The above criteria can be written in JSON as shown below:

{
"contentId": "ffb3a2d1-20e8-4e27-88a0-690cdbca24ca",
"resultAction": "NEW_CONTENT",
"targetFormat": "png",
"newContentSpecification": {
"description": "Content created by a conversion request",
"name": "My Converted PDF",
"parentId": "62175e32-e879-4c4c-81cd-4f049e3db018"
}
}

Parameters

The following table lists the parameters and their descriptions:

NameRequiredData typeDescription
contentIdtruestringThe content ID of the source content.
resultActionstringSignals to D1 that a new content must be created instead of a CONTENT_REPRESENTATION.
targetFormatstringSignals to D1 that the image format must be .png.
newContentSpecificationobjectThe object with the specification for the new content.
newContentSpecification.descriptionstringThe description of the new content.
newContentSpecification.namestringThe name of the new content.
newContentSpecification.parentIdstringThe ID of the folder where the new content must be created.

Task 2: Sending the conversion request

Do the following to send a conversion request with new content specification to D1:

  1. Open an API client (Postman or a similar tool of your choice).

  2. Send an authentication request to get the sessionId value. Example authentication request:

    POST https://adx-host:port/tribefire-services/api/v1/authenticate?user=username&password=password

    Session ID is returned as a result:

    "20200312135607614-35259900-10b3-46d7-9a2b-7b052132c3bb"
  3. Send a request to http://adx-host:port/tribefire-services/api/v1/<access.adx.content.repository_name>/v1/convert/image, passing the JSON with your specification in the request body. Add the session ID as a query parameter sessionId:

    Request:

    http://<adx-host:port>/tribefire-services/api/v1/<access.adx.content.repository_name>/v1/convert/image?sessionId=20200312135607614-35259900-10b3-46d7-9a2b-7b052132c3bb

    Replace <adx-host:port> and <access.adx.content.repository_name> with the actual values.

    Request body:

    {
    "contentId": "ffb3a2d1-20e8-4e27-88a0-690cdbca24ca",
    "resultAction": "NEW_CONTENT",
    "targetFormat": "png",
    "newContentSpecification": {
    "description": "Content created by a conversion request",
    "name": "My Converted PDF",
    "parentId": "62175e32-e879-4c4c-81cd-4f049e3db018"
    }
    }

    See Parameters table above for details.

    As a result, a conversion job ID is returned and conversion job is started:

    {
    "_type": "tribefire.adx.model.content.service.v1.request.conversion.ConversionResponse",
    "duration": 359,
    "jobId": "200312135712221be06696bf6f488095"
    }
  4. Verify the status of the conversion job in D1 Administrator. When job status is set to Done, your new document should be ready.

For code samples on different types of conversion, see:

Convert content to images, PDFs, or e-mail by ID:

Convert to email by IDs
Convert to image by ID
Convert to PDF by ID

Merge contents or templates by ID:

Merge by IDs
Merge templates by IDs

Search and replace content by ID:

Search and replace by ID
Search and replace by ID single search

Apply templates or watermarks by ID:

Apply template by ID
Apply watermark by ID

Extract text by ID:

Extract text by ID

Split content by ID:

Split by ID

Create document representation by ID:

Create document representation by ID