cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Daveyyydave
Frequent Visitor

Custom connector for Box Upload API

Hello!

 

I am running into an issue creating a custom connector that will upload a pdf file to box folder.  I am configuring the custom connector with the BOX Upload API.  I have postman setup properly to upload file but when I import them to custom connector it does not configure properly.   Below is working postman command that uploads file to box.

Daveyyydave_0-1638231290116.png

 

 The BOX Upload API uses a post with the body in form-data and two keys, the attributes key and file key.  The attributes key has the file attribute, like file name, what box folderid to put the file in, etc.  I am having a hard time building this part out in custom connectors.

Daveyyydave_1-1638231384775.png

 

 

Has anybody here have any success or have done any box custom connector using upload api?  Would appreciate some insights, thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Daveyyydave
Frequent Visitor

Solved!  This is formatting on the API.  Once formatted correctly, box was able to handle request.

View solution in original post

8 REPLIES 8
Daveyyydave
Frequent Visitor

Might be making some advancements...but think multipart section might be some formatting issue?  Errored is NotFound and output was 404.

 

Daveyyydave_0-1638285369073.png

Daveyyydave_1-1638285421872.png

 

 

Daveyyydave
Frequent Visitor

Some more progress, the response is a 400, "API upload did not contain a file part"  So I know its a formatting issue.

 

Daveyyydave_0-1638459374793.png

 

My flow details look like this:

 

Daveyyydave_1-1638459413896.png

 

 

The raw request:

 

{
"host": {
"connectionReferenceName": "shared_box-20upload--",
"operationId": "Uploadfile"
},
"parameters": {
"Content-Type": "multipart/form-data;boundary=WebKitFormBoundary7MA4YWxkTrZu0gW",
"body/$multipart": [
{
"headers/Content-Disposition": "form-data; name=\"attributes\"",
"value": "{\n \"name\": \"test11.pdf\",\n \"parent\": {\n \"id\": \"142982795411\"\n }\n}"
},
{
"headers/Content-Disposition": "form-data; name=\"file\", filename=\"\"",
"value": {
"@odata.type": "#microsoft.graph.fileAttachment",
"id": "AAMkADExNjVhMzg0LWQyMTEtNDNkYi05YWE3LTYwMDk1OGE1YTJmYQBGAAAAAAAbdnwb3G2yR7Pj0aWJn6DTBwBfi9w1M-rwRqySYi6aOKx_AAUvV8t_AABfi9w1M-rwRqySYi6aOKx_AAUzpl0KAAABEgAQACiSHdJ6iRlHqkaX5_xdF3k=",
"lastModifiedDateTime": "2021-12-01T20:58:43+00:00",
"name": "Order_7357678#en-US_Ordered_PacificStandardTime.pdf",
"contentType": "application/pdf",
"size": 102452,
"isInline": false,
"contentBytes": "JVBERi0xLjQ-----etc"
}
}
]
}
}

 

 

 

Daveyyydave
Frequent Visitor

Solved!  This is formatting on the API.  Once formatted correctly, box was able to handle request.

abc4swc
Frequent Visitor

@Daveyyydave What was the correct formatting? Running into same issue.

How did you solve it? Running into same issue.

abc4swc
Frequent Visitor

@Shimoyama we got it to work with this: 

abc4swc_0-1648063635051.png

where "Outputs" in the body is:

binary({"name":"filename","parent":{"id":"folder"}}

Shimoyama
Frequent Visitor

Please tell me all the steps to create the flow.
I still get the error.

abc4swc
Frequent Visitor

First dynamic input is the filename and varfolder is the folder ID.

abc4swc_0-1649162899376.png

The body of the above is:

{

  "grant_type": "client_credentials",

  "client_id": "",

  "client_secret": "",

  "box_subject_type": "enterprise",

  "box_subject_id": "",

  "scope": "root_readwrite"

}

fill in your own client id, client secret and box id.

Then compose using binary of the varBinaryCode.

abc4swc_1-1649163016439.png

Full json above:

{
    "type""object",
    "properties": {
        "access_token": {
            "type""string"
        },
        "expires_in": {
            "type""integer"
        },
        "restricted_to": {
            "type""array"
        },
        "token_type": {
            "type""string"
        }
    }
}
Then the upload step I already sent that starts with this. 
abc4swc_2-1649163166730.png

 

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,936)