logoBack to home screen

Sending Conversion Requests with New Content Specification

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

Writing New Content Specification in JSON

Since the specification can include any content property, let's assume the following criteria:

  • 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", //contentId of the source content
  "resultAction": "NEW_CONTENT", //telling ADx that we want a new content, not a CONTENT_REPRESENTATION
  "targetFormat": "png", //telling ADx we want a .png image
  "newContentSpecification": { //this is the object with our specification for the new content
    "description": "Content created by a conversion request", //new content description
    "name": "My Converted PDF", // new content name
    "parentId": "62175e32-e879-4c4c-81cd-4f049e3db018" //ID of the folder where new content should be created
  }
}

Sending the Request

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

  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", //contentId of the source content
    "resultAction": "NEW_CONTENT", //telling ADx that we want a new content, not a CONTENT_REPRESENTATION
    "targetFormat": "png", //telling ADx we want a .png image
    "newContentSpecification": { //this is the object with our specification for the new content
      "description": "Content created by a conversion request", //new content description
      "name": "My Converted PDF", // new content name
      "parentId": "62175e32-e879-4c4c-81cd-4f049e3db018" //ID of the folder where new content should be created
    }
    }
    

    As a result, conversion job ID is returned and conversion 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 ADx Cache Area. When job status is set to Done, your new document should be ready.