Skip to main content

Notifications

Power Automate - Using Connectors
Unanswered

custom API with custom connectors

(0) ShareShare
ReportReport
Posted on by 108

Hi

 

I am new to power app custom connectors - could you help with this ?

 

The call is successfully with javascript below but I don't know what settings I need to do for custom connectors (I did some tests with a public API and this is working just I don't know for this one below what I need to set)

 

 

async function fetchWebApi()

{

 

var details = {

    'userName': ‘username’,

    'password': 'password',

    'grant_type': 'password'

};

 

var formBody = [];

for (var property in details) {

  var encodedKey = encodeURIComponent(property);

  var encodedValue = encodeURIComponent(details[property]);

  formBody.push(encodedKey + "=" + encodedValue);

}

formBody = formBody.join("&");

 

let response = await fetch('http://XXXX/token', {

  method: 'POST',

  headers: {

    'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'

  },

  body: formBody

})

 

let commit = await response.json();

 

console.log(commit);

 

console.log("Status " + response.status);

alert("Status " + response.status);

 

if (commit != null)

{

  console.log(commit.access_token);

  getAllClients(commit.access_token);

}

 

}

 

async function getAllClients(acessToken) {

 

  let response = await fetch('http://XXX:80/method', {

    headers: new Headers({

                             'Authorization': 'Bearer ' + acessToken,

                             'Content-Type' : 'application/x-www-form-urlencoded;charset=UTF-8'

              }),

    method: 'GET'

  })

 

  let result = await response.json();

 

  console.log(response);

  console.log(result);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,495

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,822

Leaderboard

Featured topics