Created
May 29, 2021 06:39
-
-
Save ktskumar/fe432775b27cd5b16f39ec3a0dc05c03 to your computer and use it in GitHub Desktop.
Microsoft PowerPlatform Connections
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getRequest(url) { | |
var request = new XMLHttpRequest(); | |
return new Promise(function(resolve, reject) { | |
request.onreadystatechange = function() { | |
if (request.readyState !== 4) return; | |
if (request.status >= 200 && request.status < 300) { | |
resolve(request); | |
} else { | |
reject({ | |
status: request.status, | |
statusText: request.statusText | |
}); | |
} | |
}; | |
request.open('GET', url, true); | |
request.setRequestHeader("Content-Type", "application/json;charset=utf-8"); | |
request.setRequestHeader("ACCEPT", "application/json; text/plain, */*"); | |
request.setRequestHeader("AUTHORIZATION", "Bearer " + window.sessionInfo.userInfo.accessToken); | |
request.setRequestHeader("ODATA-VERSION", "4.0"); | |
request.send(); | |
}); | |
} | |
var environmentid = 'Default-6a0axxxx-xxxx-xxxx-xxxx-xxxx169d1115' | |
getRequest("https://india.api.powerapps.com/providers/Microsoft.PowerApps/connections?api-version=2016-11-01&$filter=environment eq '"+environmentid+"'").then(function(resp) { | |
console.log(JSON.parse(resp.response)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment