I am creating a SP designer workflow for my SharePoint Online site to get user properties like manager`s name, location, department etc. I am using below REST URL in 'Call HTTP Web Service' action
https:/siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='Manager')?@v=%27i:0%23.f|membership|userid%27 .
I am a site collection admin but still I am getting error -
"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission to perform this action or access this resource."}}}"
I have already given Full Control to workflow app. But when I access above REST URL in a browser, I can see all properties for any user.
Please let me know where am I doing a mistake.
The workflow must have tenant-level permissions(In your case-Read)
in order to access the User Profile Service instead of having full control at site collection
When giving rights make sure the following XML is used :
<AppPermissionRequests>
<AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="Read" />
</AppPermissionRequests>
Here are useful links