Request Parameters
Name | Type | Description | Location | Required | Default | Options |
---|---|---|---|---|---|---|
PermissionId | Guid | Permission Id being checked. | Query String | Required | ||
UserId | Guid | User Id being checked. | Query String | Required | ||
ContentId | Guid | Content Id where the permission is being checked. If neither ContentId nor ApplicationId are provided, the permisison will be checked at the site root. | Query String | Optional | ||
ContentTypeId | Guid | Content Type Id for the content where the permission is being checked. Required if passing in a ContentId. | Query String | Optional | ||
ApplicationId | Guid | Application Id where the permission is being checked. If neither ContentId nor ApplicationId are provided, the permisison will be checked at the site root. | Query String | Optional | ||
ApplicationTypeId | Guid | Application Type Id for the application where the permission is being checked. Required if passing in a ApplicationId. | Query String | Optional |
Example Requests
C# REST SDK
This example uses the REST SDK to access the Community REST API within a .Net C# application. In the example, USER_NAME
is the user name of the effective user for the request and OAUTH_CLIENT_ID
and OAUTH_SECRET
are the OAuth client ID and secret, respectively, associated to this application as configured in Administration > Integration > OAuth Clients with the "Client Credentials" grant type enabled. See the documentation for the REST SDK for more details about installation, configuration, and usage options.
var host = new ClientCredentialsRestHost("USER_NAME", "https://mysite.com/", "OAUTH_CLIENT_ID", "OAUTH_SECRET"); var response = host.GetToDynamic(3, "permission.json", false, new RestGetOptions { QueryStringParameters = new System.Collections.Specialized.NameValueCollection { { "PermissionId", "49fec544-6df7-4a82-872b-f8be586d5e9e" }, { "UserId", "49fec544-6df7-4a82-872b-f8be586d5e9e" } } });
Widget Javascript
This example uses the rest JavaScript API to access the Community REST API within the Community web UI. When accessing the REST API through the javascript API, the effective user is the current contextual user of the web interface.
jQuery.telligent.evolution.get({ url: jQuery.telligent.evolution.site.getBaseUrl() + 'api.ashx/v3/permission.json', data: { 'PermissionId': '49fec544-6df7-4a82-872b-f8be586d5e9e', 'UserId': '49fec544-6df7-4a82-872b-f8be586d5e9e' }, success: function(response) { } });
cURL
This example uses the cURL command-line HTTP utility. ENCODED_TOKEN
in the example is the base64-encoded concatenation of the user's API key (created from the user's profile), a colon (:), and the user's user name. Learn more about using the REST API.
curl -H "Rest-User-Token: ENCODED_TOKEN" -X GET https://mysite.com/api.ashx/v3/permission.xml?PermissionId=49fec544-6df7-4a82-872b-f8be586d5e9e&UserId=49fec544-6df7-4a82-872b-f8be586d5e9e
Example Responses
XML
<?xml version="1.0" encoding="utf-16"?> <Response> <Permission> <Id>49fec544-6df7-4a82-872b-f8be586d5e9e</Id> <Name>name</Name> <IsAllowed>true</IsAllowed> </Permission> <Errors> <Message>string</Message> <Message>string</Message> </Errors> </Response>
JSON
{ "Permission": { "Id": "49fec544-6df7-4a82-872b-f8be586d5e9e", "Name": "name", "IsAllowed": true }, "Errors": [ "string", "string" ] }