how to create asset by API

Hi All,

I need to perform a test for creating assets in Postman, but after making a POST request, I receive the following error in the response:

"message": "Invalid parameter value was specified.
"debug_message": "Asset data should be specified.",

I reference this page but I don't know what I did wrong.

Below are the parameters I sent.

POST https://xxxx/otmmapi/v6/assets

key value

files I used text file for test.

asset_representation {"parent_folder_id": "****","import_template_id":"****"}

manifest {"files": [{"fileName": "test.txt","title": "test","description": "A test text file"}]}

Could someone please help me with this?

Sam

Tagged:

Best Answer

  • Govinda Raju Mekala
    #2 Answer ✓

    Try this ,it's a working example

    --form 'parent_folder_id="949832953fd446256565a8f3f4ead29684d6eb0c"' (OTMM Folder ID -Optional parameter)
    --form 'import_job_id="49557"' (import Job id created in previous Step)
    --form 'manifest="{"upload_manifest":{"master_files":[{"file":{"file_name":"pexels-cup-of-couple-8472308.mp4","file_type":"video/mp4"}},{"file":{"file_name":"7158392-00028400480611_C2C1-S.JPG","file_type":"image/jpeg"}}]}}"'
    --form 'asset_representation="{"asset_resource":{"asset":{"metadata":{"metadata_element_list":[]},"metadata_model_id":"OTMM.MODEL.CONTENTSTACK","security_policy_list":[{"id":79}]}}}"'
    --form 'import_template_id="140382a734e5da7a642e9ee0ed45f9b9a7740cfd"' //If we pass this parameter we can skip metadata_model_id & security_policy_list in asset representation.

    And i forget to ask,How are you handling the authetication.

Answers

  • Govinda Raju Mekala
    #3 Answer ✓

    Try this ,it's a working example

    --form 'parent_folder_id="949832953fd446256565a8f3f4ead29684d6eb0c"' (OTMM Folder ID -Optional parameter)
    --form 'import_job_id="49557"' (import Job id created in previous Step)
    --form 'manifest="{"upload_manifest":{"master_files":[{"file":{"file_name":"pexels-cup-of-couple-8472308.mp4","file_type":"video/mp4"}},{"file":{"file_name":"7158392-00028400480611_C2C1-S.JPG","file_type":"image/jpeg"}}]}}"'
    --form 'asset_representation="{"asset_resource":{"asset":{"metadata":{"metadata_element_list":[]},"metadata_model_id":"OTMM.MODEL.CONTENTSTACK","security_policy_list":[{"id":79}]}}}"'
    --form 'import_template_id="140382a734e5da7a642e9ee0ed45f9b9a7740cfd"' //If we pass this parameter we can skip metadata_model_id & security_policy_list in asset representation.

    And i forget to ask,How are you handling the authetication.

  • Sam Wu
    Sam Wu Member
    edited June 19 #4

    Hi Govinda Raju Mekala,

    Thanks for your help. Authetication works and your example works, but I'm running into other issues. The images I uploaded successfully were marked as "NOT SPECIFIED".

    Below are the parameters I sent.

    --form 'parent_folder_id="****"'
    --form 'manifest={"upload_manifest":{"master_files":[{"files": [{"file_name": "test.jpg","file_type": "image/jpeg"}]}]}}
    --form 'asset_representation={"asset_resource":{"asset":{"metadata":{"metadata_element_list":[]},"security_policy_list":[{"id":10}]}}}
    --form 'import_template_id="****"'

    Do I need to pass more parameters?

    Sam