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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

How to access the data from POST API

Hi All,

 

I need to access the data from the POST API provided by the client

 

can anyone, please help me which option is used for to access the dataAPI.png

 

Thanks

3 REPLIES 3
SteveCampbell
Memorable Member
Memorable Member

You cannot pass authorization this way, the only way you can access is through selecting anonymous.

 

Instead, you must pass any authorization (such as Bearer Token) through the headers argument for web.contents.

 

In addition, to make it a POST request, you MUST add the argument of Content.

 

Here is a format I like. Note that i make the headerv and contentv both into JSON format first - this makes it easier to write and to view.


Take note of the argument [Headers = headerv, Content = Json.FromValue(contentv)]. As it is JSON I must convert the contentv using Json.FromValue. In addition, i've called Content-Type as application/json.

 

I should note, this particular query is to return an access token from OAUTH2. If you have one, you would include the parameter in the headers. 

 

Please don't copy the values, you will need to add the specific arguments to headersv and contentv as required.

 

 

headerv = [ 
#"Content-Type" = "application/json",
#"Accept" = "*/*"
],

contentv = [
#"grant_type" = "client_credentials",
#"client_id" = "{clientid}",
#"client_secret" = "{secret}"
],

Source = (Web.Contents("https://url/oauth2/token", [Headers = headerv, Content = Json.FromValue(contentv)])),

#"Imported JSON" = Json.Document(Source, 1252),

 



Did I answer your question? Mark my post as a solution! Proud to be a Super User!


Connect with me!
Stay up to date on  
Read my blogs on  



Anonymous
Not applicable

Thank you for your reply.

 

I have tried the most such codes before and this one also, but I don't know where is the fault:

 

What process I have applied in Postman: (Step by Step)

 

1. I have a URL to get the jwt key value:

    https://xxx(client website).azurewebsites.net/dev/auth/user/authenticate

2. Here I have passed the Body contents: (Payload)

 

      {

                "TenantId": "Client2",

                "UserSignon": "corp2019",

                "Password": "test"

    }

 3. From the second step, I got the "jwt"  value shows below

 

jwt.png

 

4. I having another URL where I have passed the KEY Name and Key-value generated from 2nd step(jwt)

 URL:  https://xxx(client website).azurewebsites.net/dev/master-data/departments/get

 KeyName: X-Token

Value: jwt generated passed here

 

5. Then I got the data which I have to access:

uilist.png

 

I request, can you please send me the code for the same process.

 

Thanks

Anonymous
Not applicable

Need Token Key?

Well, for me is:

1 - Organizational account if you have one

2 - Web API

3 - Basic

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors