"On-behalf-of"
Make REST Platform API requests for specific users and teams.
Users with Enterprise Access to the Platform API can read or make changes to data on behalf of other users or teams through the Platform API. To use the "on-behalf-of" functionality:
-
Navigate to the endpoint that you wish to trigger on behalf of a user or team.
-
Insert an "on-hehalf-of" header with value "userId" or "teamId" (depending on the endpoint).
For example, if you want to make edits to a certain team, you would want to send a request on behalf of a team.
--url https://rapidapi26.p.rapidapi.com/v1/users/%7BuserId%7D \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-rapidapi-host: rapidapi26.p.rapidapi.com' \
--header 'on-behalf-of: 123456' \
--data '{ "email": "", "name": "", "username": "", "password": ""}
For more example of the use of "on-behalf-of", see Example Using the REST Platform API: Listing all APIs.
Important notes on using on-behalf-of
You must have Enterprise Access to the Platform API to use the "on-behalf-of" functionality.
If you are calling an endpoint, such as Get All Teams, on-behalf-of of an org admin, that org admin must have their Personal Context enabled. See Roles and Permissions.
ownerId vs. on-behalf-of
Some REST Platform API endpoints have an ownerId header, which is somewhat similar in functionality to on-behalf-of. For example, when creating an API using an OpenAPI document , you can specify the user or team that will own the API. The API will then be shown in that user or team's context, as if they created the API. This is especially useful for calls to the REST Platform API from continuous delivery pipelines.
"On-behalf-of" supported endpoints
In some cases, the "on-behalf-of" header can be specified in your code even though the header is not shown in the API playground.
Tag Definitions | Put/Delete/Post |
API | Get API Get Analytics Get Subscriptions Get API Subscriptions |
Teams | Update Team Get Team Delete Team Get Users for a Team Get Teams Remove Team User Add Team User Create Team |
Subscription | Get User Subscription Get User Subscription Analytics Delete Subscriptions Get User Subscriptions Create Subscriptions |
API Version Docs | Get API Version Doc Create API Version Doc Delete API Version Doc Update API Version Doc |
API Developers | Un-invite API Developers Invite API Developers Get API Developers |
Apps | Get App Analytics Delete App Create App Update App Get App Get User App |
Version Tag | Delete API Version Tag Get API Version Tag Add API Version Tag Get API Version Tag |
Users | Update User Delete User Get User Teams Create User Get Users Get User |
Organization | Delete Organization Get Organization Create Organization Update Organization Get Organization Get Organization Audit Log |
Updated 12 months ago