cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
gelliott02 Regular Visitor
Regular Visitor

Push New pbix file using PBIRS API Method /PowerBIReports({Id})/Model.Upload

Seems like there is an issue with POST upload method when trying to upload a new pbix file. While the description of this method says:

 

Does an efficient binary upload of a new or existing PowerBIReport CatalogItem from a multipart/form-data request. Use of this API is recommended for files larger than 25 MB in size. (https://app.swaggerhub.com/apis/microsoft-rs/pbirs/2.0#/PowerBIReports/UploadPowerBIReport)

 

One of the parameters that is required is causing it to fail. It has to have the path or GUID on the server to the pbi file you are trying to upload. Obviously if I am uploading a new report there wouldn’t be a path or GUID on the server because that object doesn’t exist yet. I’ve tried calls just using the location I would like the report to be uploaded to but I get an object not found error. Probably because it’s a new report and it doesn’t exist on the server.

 

Call I made using the path I would like the new report to be uploaded to:

curl -vX --ntlm -u username POST "https://server/Reports/api/v2.0/PowerBIReports(path='/New_Folder_Test/example')/Model.Upload" --header "accept: application/json" --header "Content-Type: multipart/form-data" --form File=@example.pbix

 

Response (notice it finds the file I want to upload but the target can’t be located on the Server because it's a new file IT DOESN'T EXIST!):

Enter host password for user 'username':

* STATE: INIT => CONNECT handle 0xa2f160; line 1392 (connection #-5000)

* Rebuilt URL to: POST/

* Added connection 0. The cache now contains 1 members

* STATE: CONNECT => WAITRESOLVE handle 0xa2f160; line 1428 (connection #0)

* Could not resolve host: POST

* Closing connection 0

* The cache now contains 0 members

curl: (6) Could not resolve host: POST

* STATE: INIT => CONNECT handle 0xa2f160; line 1392 (connection #-5000)

* Added connection 1. The cache now contains 1 members

* STATE: CONNECT => WAITRESOLVE handle 0xa2f160; line 1428 (connection #1)

*   Trying 10.176.72.85...

* TCP_NODELAY set

* STATE: WAITRESOLVE => WAITCONNECT handle 0xa2f160; line 1509 (connection #1)

* Connected to server (10.176.72.85) port 443 (#1)

* STATE: WAITCONNECT => SENDPROTOCONNECT handle 0xa2f160; line 1561 (connection #1)

* Marked for [keep alive]: HTTP default

* ALPN, offering h2

* ALPN, offering http/1.1

* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH

* successfully set certificate verify locations:

*   CAfile: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt

  CApath: none

* TLSv1.2 (OUT), TLS header, Certificate Status (22):

* TLSv1.2 (OUT), TLS handshake, Client hello (1):

* STATE: SENDPROTOCONNECT => PROTOCONNECT handle 0xa2f160; line 1575 (connection #1)

* TLSv1.2 (IN), TLS handshake, Server hello (2):

* TLSv1.2 (IN), TLS handshake, Certificate (11):

* TLSv1.2 (IN), TLS handshake, Server key exchange (12):

* TLSv1.2 (IN), TLS handshake, Server finished (14):

* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):

* TLSv1.2 (OUT), TLS change cipher, Client hello (1):

* TLSv1.2 (OUT), TLS handshake, Finished (20):

* TLSv1.2 (IN), TLS change cipher, Client hello (1):

* TLSv1.2 (IN), TLS handshake, Finished (20):

* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384

* ALPN, server did not agree to a protocol

* Server certificate:

*  subject: CN=*.domain.regn.net; O=RELX Inc.; L=New York; ST=New York; C=US

*  start date: Apr  2 13:28:15 2018 GMT

*  expire date: Apr  1 19:28:15 2020 GMT

*  subjectAltName: host "server" matched cert's "*.domain.regn.net"

*  issuer: C=US; ST=Illinois; L=Chicago; O=Trustwave Holdings, Inc.; CN=Trustwave Organization Validation SHA256 CA, Level 1; emailAddress=ca@trustwave.com

*  SSL certificate verify ok.

* STATE: PROTOCONNECT => DO handle 0xa2f160; line 1596 (connection #1)

* Server auth using Basic with user 'domain\username'

> --ntlm /Reports/api/v2.0/PowerBIReports(path='/New_Folder_Test/example')/Model.Upload HTTP/1.1

> Host: server

> Authorization: Basic basichashpw

> User-Agent: curl/7.58.0

> accept: application/json

> Content-Length: 532896957   (finds local file fine)

> Content-Type: multipart/form-data; boundary=------------------------ee0faf19e3769bfb

> Expect: 100-continue

> 

* STATE: DO => DO_DONE handle 0xa2f160; line 1658 (connection #1)

* STATE: DO_DONE => WAITPERFORM handle 0xa2f160; line 1783 (connection #1)

* STATE: WAITPERFORM => PERFORM handle 0xa2f160; line 1799 (connection #1)

* HTTP 1.1 or later with persistent connection, pipelining supported

< HTTP/1.1 404 Not Found

< Cache-Control: no-cache

< Content-Length: 227

< Content-Type: application/json; odata.metadata=minimal

* Server Microsoft-HTTPAPI/2.0 is not blacklisted

< Server: Microsoft-HTTPAPI/2.0

< X-Content-Type-Options: nosniff

< Set-Cookie: XSRF-NONCE=nonce%3D; path=/Reports; HttpOnly

< Set-Cookie: XSRF-TOKEN=deprecated; path=/Reports

< OData-Version: 4.0

< Date: Mon, 09 Sep 2019 16:14:58 GMT

* HTTP error before end of send, stop sending

* Marked for [closure]: Stop sending data before everything sent

< 

{

  "error":{

    "code":"","message":"No HTTP resource was found that matches the request URI 'http://server/Reports/api/v2.0/PowerBIReports(path%3D'/New_Folder_Test/example')/Model.Upload'."

  }   expects an existing report called example. So how can this be used for new files?

}* STATE: PERFORM => DONE handle 0xa2f160; line 1968 (connection #1)

* multi_done

* Closing connection 1

* The cache now contains 0 members

* TLSv1.2 (OUT), TLS alert, Client hello (1):

* Expire cleared

 

I tried with just the existing folder and got the same:

curl -vX --ntlm -u domain\username POST "https://server/Reports/api/v2.0/PowerBIReports(path='/New_Folder_Test')/Model.Upload" --header "accept: application/json" --header "Content-Type: multipart/form-data" --form File=@example.pbix

 

Response error:

{

  "error":{

    "code":"","message":"No HTTP resource was found that matches the request URI 'http://server/Reports/api/v2.0/PowerBIReports(path%3D'/New_Folder_Test')/Model.Upload'."

  }

 

A call to get the folder metadata works fine:

curl -v --ntlm -u domain\username GET https://server/Reports/api/v2.0/Folders(path='/New_Folder_Test') --header "Content-Type: application/json"

Response:

{

  "@odata.context":"http://server/Reports/api/v2.0/$metadata#Folders/$entity","Id":"62764f50-8479-40ef-9cc0-2ba2fecfb360","Name":"FIDO_Testing","Description":null,"Path":"/FIDO_Testing","Type":"Folder","Hidden":false,"Size":0,"ModifiedBy":"domain\\username","ModifiedDate":"2019-09-05T11:18:51.413-04:00","CreatedBy":"domain\\username","CreatedDate":"2019-08-28T15:19:19.877-04:00","ParentFolderId":"fac77548-84a9-488b-aeca-14607954dc30","IsFavorite":false,"Roles":[



  ],"ContentType":null,"Content":""

}

 

Helpful resources

Announcements
Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 292 members 3,050 guests
Please welcome our newest community members: