Posted Aug 08 by Zachary Woodard.
Updated Aug 12.

Hopefully this will save someone some time...

Last activity Aug 20 by Arvind Subramanian.
36 views. 2 comments.

A little background: I've never worked with an OpenText API and this first effort left me a little bruised but once I had the tools it went really well. Hopefully this post will help someone else get a head start with minimal effort. This worked for me in my companies' implementation. You may have to make changes to match your installation.

  1. Download the Programmers guide! I did a Search for 'Programmers Guide' in the Knowledge Base
  2. Unzip the Programmers guide and find the JSON Data samples for upload Manifest and asset representation (uploadManifest.json and assetRepresentation.json)
  3. Read the Swagger doc to set up your Postman Query. To upload, you will probably need 2 endpoints, Post to /v5/sessions and Post to /v5/assets/. The Swagger docs are in the API reference on Opentext or possibly available on your companies' OTMM implementation at http://your.company.url:port/swagger-ui
  4. Set up your files for upload. You will need: An image or asset you'd like to upload, the assetRepresentation.json file, the uploadManifest.json file, your swagger documentation and access to the OTMM Administration Website OR someone you can bug about it :D
  5. Edit the Asset representation file to match your particular installation. I changed the metadata fields array to match the custom Fields our organization created. I made sure to match the Ids and Names and set the various flags to match the ones listed in the OTMM Admin screens for the field. Data types for the value section is in the swagger Doc. I also made sure the associated Model (metadata_model_id) matched. Lastly, I made sure the id and name of the security policy matched what was in the OTMM Admin screens.
  6. Edit the uploadManifest.json file. This one is MUCH easier, just set the file name and mime type appropriately. Bing, Done!
  7. Set up the /v5/assets form in Postman. I had to set a custom header X-Requested-By:Session ID. This will be retrieved in a later step
  8. Choose “form-data” as the type in Postman and set the keys for:
    a. asset_representation - type -> file - choose the assetRepresentation.json file you edited earlier
    b. import_template_id - type -> auto - value: guid - I got this from the OTMM Admin Page
    c. parent_folder_id - type -> auto value: guid - I got this from the OTMM UI when I browsed folders I had access to
    d. no_content - type -> auto - value: false
    e. manifest - type -> file - Choose the uploadManifest.json file you edited earlier
    f. files - type -> file - choose the picture to upload that matches the file name in the upload manifest
    g. job_name - type -> auto - Type in any string. Whatever you want.
  9. Run a Post against the /v5/sessions/ endpoint. This creates a new session. I had to set a header for Content-Type:application/x-www-form-url-encoded. The Body will contain the fields username and password with appropriate values.
  10. Save the “id” field of the Session Object in the response. You can do this manually or with a Javascript Test. (Pasted Below)
  11. Run a Post against the /v5/assets/ endpoint. This will create the new asset

Postman Javascript to save the Session ID:
pm.test(“Response should be JSON and have an Access Token”, function ()
{

pm.response.to.be.ok;
pm.response.to.be.withBody;
pm.response.to.be.json;

if (responseCode.code === 200)
{
    var data = JSON.parse(responseBody);
    pm.environment.set("Your-Postman-Variable-Name-Here", data.session_resource.session.id);
}

})

2 Comments

0

Thank you Zachary for the post. I am trying the same at this time but have not had any success via postman. My dev instance at this time is just a basic implementation of media management. I have not created any custom metadata as of now. I am getting an error_code of 1000 and a http_Response_code of 400 for the same. Would it be possible for you to also attach your postman project as a reference?


0

I was able to determine the issue. I was not passing the x-requested-by value as part of the call. Thank you for the information.


Table of Contents

Your comment

To leave a comment, please sign in.