I am working on the file upload using box endpoints in OutSystems. I have just created the folder using that box endpoint. Now I trying to do a file upload on the folder I have created in the box application.
I have run these endpoints in the postman and I successfully uploaded the file in that box folder.
In outsystems, I don't know where to upload the file. Can anyone help me to solve this issue? and share any OML. It would be a great help for me.
I have attached my OML for reference. I have used reactive web application.
Please refer to Box Connector @ https://www.outsystems.com/forge/component-overview/586/box-connector-o11.
This box connector supports only the traditional web application only, I am using the reactive web application.
There is no box connector for reactive in forge yet. What you could do is build one yourself by referring the traditional one.
Yes, I am just trying to use the endpoints, While trying to build that I got stuck. Can you please help on that @Siya
Do "Add REST API Method" under the existing endpoint with POST andURL as https://upload.box.com/api/2.0/files/content. Paste the following
--BOUNDARY
Content-Disposition: form-data; name="attributes"
Content-Type: application/json
{"name":"Contract.pdf", "parent":{"id":"11446498"}}
Content-Disposition: form-data; name="file"; filename="Contract.pdf"
Content-Type: application/pdf
[BINARY PDF CONTENT HERE]
--BOUNDARY--
in the request and finish the process.
You can call this method in your action by passing the filename, id and file content. This is based on the reference given here for Multipart/form-data
btw I am not sure how to change the Content-Type of the file dynamically.
No, It is not working.
Please see attached OML. I could not test it as I don't have the parent id. Do set Client ID and Client Secret in Site Properties.
Hi @Siya ,
I tried the above oml facing 400 Bad Request Error. Do we also need to configure in OutSytems before using directly using its API. How to configure in OutSytems ?
Before calling the API, you must configure the Site Properties by setting the Client ID and Client Secret. Additionally, you need to specify the parent id on the screen
Hi @Siya , Used the same oml file, I have set Client ID and Client Secret also the parent Id but facing 400 Bad Request Error. I don't what mistake I am doing.
Can you share a valid parent id ? Will update you once there is some progress.
Parent ID: 255876114271
Please find the OML file below
Could you please check if the Parent ID you've provided is correct ? I get a 404 error when attempting to retrieve information for the specified parent ID.
This is the ID, i am using
Ok. Please share the equivalent curl command from Postman. You can get it by clicking Code option next to Send button
curl --location --request GET 'https://api.box.com/2.0/folders/255876114271' \--header 'Authorization: Bearer QvKKrGY0Zz1nEVyaXQzgIS8JkBe0Q94M' \--header 'Cookie: box_visitor_id=65fc245c611da8.21780000; site_preference=desktop'
The token you have provided is working but the token I have generated using the Client ID and secret key is not working. I have sent you a DM. Please check.