Forum Discussion

nicolast29's avatar
nicolast29
Helper V
4 years ago

post request

Hi folks, I wish to connect to our new software provider via Api

https://docs.api.myunisoft.fr/#b953be72-03e7-4be6-8638-d14025bdab46

 

I have no problem to make get request, but the post didn't work with PowerBi

I arrive to make the post request with https://web.postman.co/ 

https://api.myunisoft.fr/api/v1/export/fec?export_type=1&from=2021-01-01&to=2021-12-30

I cannot give you the real values, but here my code

let
    vToken = "Bearer "&"TokenXXX",
    vSecret="SecretXXX",
    vsociety="XXXX",
    vUrl = "https://api.myunisoft.fr/api/v1/export/FEC?export_type=1&from=2021-01-01&to=2021-12-30",
    body = "{""}",
    Source = Json.Document(Web.Contents(vUrl, [Headers=[Authorization="vToken", #"X-Third-Party-Secret"="vSecret", #"society-id"="vsociety",#"Content-Type"="application/json"],Content = Text.ToBinary(body)])) 

in
    Source

I try without content = text.tobinary or content = text.tobinary ="" etc ... 

My last reseach make me think that i come from that i should send a empty body information ...

 

The last error return unable to convert a value type binary in text

 

Normally the value are a FEC, a text file with value, example from postman:

 

JournalCode|JournalLib|EcritureNum|EcritureDate|CompteNum|CompteLib|CompAuxNum|CompAuxLib|PieceRef|PieceDate|EcritureLib|Debit|Credit|EcritureLet|DateLet|ValidDate|Montantdevise|Idevise|RefInterne
RAN|RAN|2101RAN3182509|20210101|10130000|Capital souscrit appelé versé|||CEX0121|20210101|S.A.N.|0|1000|||20210101|||E3182509
RAN|RAN|2101RAN3182509|20210101|11900000|Report à nouveau débit|||CEX0121|20210101|S.A.N.|9706,25|0|||20210101|||E3182509

 

 

thanks

 

6 Replies