JSON Rest API - Primary Upload URL

Primary Upload Url

Uploads an asset through the api

Different from other API calls, this call's Content-Type application/json
This one is a multipart/form-data

Request (POST)

mediadb/services/module/asset/attachments/uploadprimary

Paramaters

Must include either file or importpath

file: (optional) File to upload
importpath: (optional) Destination path on entermedia server to be saved
assetid: (required)the asset it's assigning primary asset

Sample request

 create file with json: cat source.json { "importpath":"/media/tempdata/Upload/image1024x768.jpg", "assetid":"AXDQuXsYL1Vo-ekWAexg" } curl -H "Content-Type: multipart/form-data" \ --request POST http://entermediadb.org/mediadb/services/module/asset/attachments/uploadprimary \ -b 'entermedia.keyassets=adminmdxxxx; JSESSIONID=xxx' \ --form "json=<source.json;type=application/json" \ --form "file=sample.jpg;type=multipart/form-data" 

Response

A successful request returns http 200 and status = "ok"

Sample Response

 { "sessionid": "attachmentcountattachmentmedia/catalogs/public", "page": "1", "pages": "1", "totalsize": "3", "primaryfile": "image1024x768.jpg", "attachments": [ { "id": "AXO_9AiHZ4_wwjxr-E6w", "name": "ELiBw-cUEAEUH-L.jpeg", "sourcepath": "Collections/null/Test/2020/ELiBw-cUEAEUH-L.jpeg", "folder": "", "parentsourcepath": "Collections/null/Test/2020/ELiBw-cUEAEUH-L.jpeg" }, { "id": "AXO_9AiyZ4_wwjxr-E6x", "name": "attachments.txt", "sourcepath": "Collections/null/Test/2020/ELiBw-cUEAEUH-L.jpeg", "folder": "", "parentsourcepath": "Collections/null/Test/2020/ELiBw-cUEAEUH-L.jpeg" }, { "id": "AXO_9AmyZ4_wwjxr-E6y", "name": "image1024x768.jpg", "sourcepath": "Collections/null/Test/2020/ELiBw-cUEAEUH-L.jpeg", "folder": "", "parentsourcepath": "Collections/null/Test/2020/ELiBw-cUEAEUH-L.jpeg" } ] }