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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,115)