Forum Discussion
fengka
You api call might be like this rest("/messages/id/[messageid]/kudos/give");
Change this to restadmin("/messages/id/[messageid]/kudos/give");
restadmin = it's an object to make a REST call with Administrator permissions on behalf of the user . This call essentially bypasses permission checks for the current user
I hope this helps you :)
- fengka9 years agoContributor
Hi TariqHussain,
Thanks for your reply. What id Restadmin() ? do I need to use any sdk to use this? Can we use the general Rest Client or Curl to call the REST API? Something like this:
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer vuVDPEkI+XLytr7hMGo0RkwucYF8belsX2XjI1qu+zM=“ -H "client-id: xxxxxxxxxxxxx" https://api.lithium.com/community/v1/[tanent name]/messages/id/[messageid]/kudos/give
Actually, I am using javascript fetch api for the REST : https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
How can I make the restadmin() in this scenario?
- TariqHussain9 years agoBoss
fengka
are you familiar with endpoints ? you need to create an endpoint and you will get endpoint url. with javascript you can directly hit your request to endpoint url.<#assign msgID = http.request.parameters.name.get("messageid","") /> <#if msgID !=''> <#assign messages = restadmin("messages/id/${msgID}/kudos/give").messages > </#if >
- fengka9 years agoContributor
TariqHussain I am not familiar with the endpoints you mentioned here. The code you show here looks like is a javascript template by using FreeMarker? (Sorry I am not exactly sure about it).
In my case I am using react native to develop a mobile app and it is using purely javascript to make the REST call. the calling is looking like this. I haven't found how to use restadmin() to call the api here.
fetch(httpUrl)
.then(function(response) {
return response.json();
})
.then(function(myBlob) {});
Related Content
- 6 years ago
- 9 years ago