Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
cmht
Regular Visitor

API connect - We found extra characters at the end of JSON input

Hello,

I have a problem, I get an error:

DataFormat.Error: We found extra characters at the end of JSON input.

Details:

Value=

Position=0

 

and this is about action =Json.Dcoument(GetJson)

 

Here my code:

let
authKey ="Basic " & AconexAuthorizationPair, //100% works

//Retrieve token from Aconex
GetJson =
Web.Contents(
"https://eu1.aconex.com/api/projects/XXXXXXXXXX/register",
[
Headers=[
#"Accept"="application/xml",
#"X-Application-Key"=AconexIntegrationID,
#"Authorization"=authKey
],
Query=[
#"search_query"="doctype:Plan",
#"return_fields"="trackingid,title,doctype,docno,attribute1,forreview,filename,fileType,fileSize"]
]
),

FromatAsJson = Json.Document(GetJson),

//Extract token from Json response
AccessToken = FromatAsJson[access_token]

in
AccessToken
 
Please let me know what I am doing wrong, below a Power Automate action which works:
cmht_0-1706871126484.png

 

of course above in Power Automate I just provide normal username and password, with PowerBI it is in a Base64 format username:password - but this works.

 

I think there is no token exchange, I have this code as I found it somewhere in connections with OAuth2 for Spotify, here I just need a plain JSON response, I think problem is caused after Web.Contents -> and this is a place where I don't knwo what to do.

 

Any help would be appreciated.

1 ACCEPTED SOLUTION
cmht
Regular Visitor

Hi,

I solved the issue by changing the Query, as it is not JSON -> it gives back valid XML in binary.

Now everything works.

View solution in original post

2 REPLIES 2
cmht
Regular Visitor

Hi,

I solved the issue by changing the Query, as it is not JSON -> it gives back valid XML in binary.

Now everything works.

lbendlin
Super User
Super User

Instead of attempting to parse the JSON, have a look at the raw output that comes back.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.