I am trying to construct the URL to fetch media objects from the conversations through API calls. The documentation is not very clear on how to do this. I am able to only pull gif media objects through the get request but can’t be able to pull any other types of media objects  using the same method that I have been able to successfully pull media objects. Can I kindly get some assistance on how to create the proper URLs to pull pdfs, CSVs and other type of media objects as I have not found any examples of how to create urls.
Attached are some screenshots of the responses of gifs and other media types
Â
Page 1 / 1
The error message clearly indicated that the fileId is not found. Where did you get the contentUri with the id? Did you read it from the a team and detect the id from the attachments object?
Hello ​@PhongVu Thanks for your response to this.
I just picked the contentURI from the export job that I created. I created an export job that gave me a file with the below content shown on the screenshot Â
I then used the contentURI from the export job to try and retrieve the media object. The media objects are in the folder named Files
Attached is the screenshot of the exported JSON files containing media object details, contained within the files directory Â
In the Files Directory
This here is sample object I obtained within one of the JSONÂ files. The JSON files contain lists of objects in the format provided below:
Â
 {   "id": "846731247626",   "creator": {    "id": "62579284004"   },   "chatIds": r    "923061387266"   ],   "creationTime": "2020-03-19T21:58:40.622Z",   "lastModifiedTime": "2020-07-09T14:51:09.192Z",   "lastModifiedBy": {    "id": "62579284004"   },   "name": "image.png",   "size": 78745,   "contentUri": "https://dl.mvp.ringcentral.com/file/846731247626",   "deleted": false,   "type": "File"  } ]
For a literal example, I am attaching screenshots of the get request I made using the above sample object:
Request 1
Get request made with contentURI + the media object name
Request 2
Get request made with contentURI only
I hope this is clearer to explain my challenge. Hoping to get a solution to this soon as I have been stuck on this for a while trying to figure out how to build a proper request.
Â
In that case, the second screenshot is correct. You don’t add the file name to the end of the contentUri.
Now I am not sure about the error. Can you double check the access token you used in your postman is generated for the same user who exported the team messaging compliance and under the same account?
If you want to try this on Node JS code, install the RC JS SDK and provide your app and user credentials to run the code below.
platform.on(platform.events.loginSuccess, async function(e){ console.log("Login success") var contentUri = 'https://dl.mvp.ringcentral.com/file/XXXXXXXXX' var u = url.parse(contentUri); let domain = u.host let path = u.pathname let fileName = "test.jpg" downloadFile(domain, path, fileName) });
// DOWNLOAD FILE async function downloadFile(domain, path, fileName){ var tokenObj = await platform.auth().data() var accessToken = tokenObj.access_token download(domain, path, accessToken, fileName, function(msg){ console.log(msg) console.log("Save atttachment to the local machine.") }) }