How to use the Nexar File Service

Modified on Mon, 13 Mar, 2023 at 5:04 PM

The Nexar file service allows you to upload your files so that you can then access them within requests to the API via an ID. Files are uploaded via a post request to the file service's endpoint: https://files.nexar.com/File/Upload with multipart/form-data. 


An authorized Nexar token will also need to be passed in. This token should have the following scopes: "design.domain", "user.access" and "openid". If you are generating a token in the portal these will be applied. If fetching a token programmatically, you will need to specify these.



The returned ID will be valid for 24 hours if left unused and then you will have to upload the file again to access it through the API.


Example


Below is a python example that uploads a file "input.csv"

import requests

token = "Your Nexar token here"

response = requests.post("https://files.nexar.com/File/Upload", files={"file": "input.csv"}, headers={
    "token": token
})

fileId = response.text
print(fileId)


The "fileId" variable should then be used in requests to the API to reference the file you uploaded. Please note that assumptions should not be made of the content of "fileId" as the format is subject to change.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article