tools/rest-scripts/entitlement.http (48 lines of code) (raw):

# -------HTTP REST CLIENT ------- # https://marketplace.visualstudio.com/items?itemName=humao.rest-client # # Purpose: Sample requests for Entitlement Service # Refer to manage-users.http for other samples # ----------------------- # OAUTH (Variables) # ----------------------- ### @login_base = login.microsoftonline.com/{{TENANT_ID}} @oauth_token_host = {{login_base}}/oauth2/v2.0/token @scopes = {{CLIENT_ID}}/.default openid profile offline_access # ----------------------- # OAUTH refresh_token # ----------------------- ### # @name refresh POST https://{{oauth_token_host}} HTTP/1.1 Content-Type: application/x-www-form-urlencoded grant_type=refresh_token &client_id={{CLIENT_ID}} &client_secret={{CLIENT_SECRET}} &refresh_token={{REFRESH_TOKEN}} &scope={{scopes}} # ----------------------- # API (Variables) # ----------------------- ### @access_token = {{refresh.response.body.access_token}} @ENTITLEMENTS_HOST = {{HOST}}/api/entitlements/v2 # ----------------------- # API: Version # ----------------------- ### # @name info GET {{ENTITLEMENTS_HOST}}/info Authorization: Bearer {{access_token}} Accept: application/json # ----------------------- # API: entitlements # ----------------------- ### # Get groups for the user encoded in the token # @name myPermissions GET {{ENTITLEMENTS_HOST}}/groups Authorization: Bearer {{access_token}} Accept: application/json data-partition-id: {{DATA_PARTITION}}