Revokes a RedCritter certification from a RedCritter user or team. The same cert can be issued multiple times to the same user or team if it has different expiration dates. The Expiration Date and Cert Name is a unique key. To revoke a cert the CertName and expiration date must match the cert to be revoked.
This version of the RevokeCert command is used to revoke certs from users and teams specified with the ProfileEntity value and the expiration date.
https://redcritterconnecter.com/services/gamificationv1/RevokeCert?SecretKey={SecretKey}&ProfileEntity={ProfileEntity}&CertName={CertName}&ExpirationDate={ExpirationDate}
SecretKey | string | yes | This SecretKey is an App or App Domain Secret Key. If an App Secret Key is specified, your default App Domain will be assumed. If an App Domain Secret Key is specified, that App Domain will be used. |
ProfileEntity | string | yes | The ProfileEntity represents to whom the API call will apply. This can be an email address or a team name. Multiple email addresses or teams can be specified by separating them with a semicolon. Team names can be any string value other than an email address. If a team's profile does not exist, RedCritter will create one dynamically. |
CertName | string | yes | The CertName parameter represents the RedCritter certification you would like to award. The cert must exist to be revoked. The following characters cannot be used : | = [ ] , ; |
ExpirationDate | string | yes | The date that the certification is set to expire. This must match the date listed on the cert in order for the revoke to work properly. |
Code Samples Javascript, C#
RevokeCert with JavaScript
This is a minimal example of calling the RevokeCert API via HTML and Javascript. Remember to never use your Secret Keys on the client side.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.js"></script>
<script type="text/javascript">
var connecterURL = "https://www.redcritterconnecter.com/";
function revokeCert(secretKey, profileEntity, certName, expirationDate, cbSuccess, cbFail) {
$.getJSON(connecterURL + "services/gamificationv1/revokeCert?jsoncallback=?", { secretKey: secretKey, profileEntity: profileEntity, certName: certName, expirationDate: expirationDate },
function (data) {
if (data.Submitted) {
cbSuccess(data);
} else {
cbFail(data);
}
});
}
//My Success Callback
function onMyrevokeCertSuccessHandler(data) {
//data is JSON response
alert("Request was successful");
}
//My Failure Callback
function onMyrevokeCertFailHandler(data) {
//Something went wrong
alert("Something went wrong");
}
</script>
</head>
<body>
<table>
<tr>
<td>Secret Key</td>
<td>
<input type="text" id="tSecretKey" style="width: 500px" />
</td>
</tr>
<tr>
<td>Profile Entity</td>
<td>
<input type="text" id="tProfileEntity" />
</td>
</tr>
<tr>
<td>Cert Name</td>
<td>
<input type="text" id="tCertName" />
</td>
</tr>
<tr>
<td>Expiration Date</td>
<td>
<input type="text" id="tExpirationDate" />
</td>
</tr>
<td></td>
<td>
<input type="button" onclick="revokeCert($('#tSecretKey').val(), $('#tProfileEntity').val(), $('#tCertName').val(), $('#tExpirationDate').val(), onMyrevokeCertSuccessHandler, onMyrevokeCertFailHandler)" value="Revoke Cert" /></td>
</tr>
</table>
</body>
</html>
RevokeCert with C#
This is a minmal example of calling the RevokeCert API and parsing the JSON result into a populated C# object. This example uses asynchronous techniques to raise a callback when the response is received.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.IO;
using System.Web; //Add reference to System.Web
using System.Runtime.Serialization.Json; //Add reference to System.Runtime.Serialization
namespace RedCritterConnecter.Samples
{
//Create a class to contain the response
public class RevokeCertResponse
{
public String ErrorMessage { get; set; }
public Boolean Submitted { get; set; }
public String RequestID { get; set; }
public String APIVersion { get; set; }
public String ReturnParam1 { get; set; }
public String ReturnParam2 { get; set; }
public String ReturnParam3 { get; set; }
private Int32 ErrorCode { get; set; }
}
public class RevokeCert
{
public delegate void OnRevokeCertResponse(RevokeCertResponse RevokeCertResponse);
public event OnRevokeCertResponse onRevokeCertResponse;
public delegate void OnRevokeCertResponseError(RevokeCertResponse RevokeCertResponse);
public event OnRevokeCertResponseError onRevokeCertResponseError;
const string CONST_ConnecterBaseURL = "https://www.redcritterconnecter.com/";
public void Execute(String SecretKey, String ProfileEntity, String CertName, String ExpirationDate)
{
try
{
//Create url encoded parameters in query string
String queryString = "secretkey=" + System.Web.HttpUtility.UrlEncode(SecretKey) + "&Certname=" + System.Web.HttpUtility.UrlEncode(CertName) + "&profileentity=" + System.Web.HttpUtility.UrlEncode(ProfileEntity) + "&expirationdate=" + System.Web.HttpUtility.UrlEncode(ExpirationDate);
//Create a new instance of a WebClient
WebClient wc = new System.Net.WebClient();
//Prevent this request from caching in order to ensure that it is sent to server
wc.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore);
//Attach an event handler to receive the response
wc.DownloadStringCompleted += onRevokeCertResponseReceived;
//Make the call
wc.DownloadStringAsync(new Uri(CONST_ConnecterBaseURL + "services/gamificationv1/RevokeCert?" + queryString, UriKind.Absolute));
}
catch
{
//Something went wrong communicating with the server
if (onRevokeCertResponseError != null)
{
onRevokeCertResponseError(null);
}
}
}
private void onRevokeCertResponseReceived(object sender, DownloadStringCompletedEventArgs e)
{
try
{
//Create a JSON serializer
System.Runtime.Serialization.Json.DataContractJsonSerializer s = new DataContractJsonSerializer(typeof(RevokeCertResponse));
//Copy the string into a memory stream
MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(e.Result));
//Read the stream into an object matching the response's type
RevokeCertResponse RevokeCertResponse = (RevokeCertResponse)s.ReadObject(ms);
//Work with the populated response object
if (RevokeCertResponse.Submitted == true)
{
//Request was accepted, raise the success event
onRevokeCertResponse(RevokeCertResponse);
}
else
{
//Something went wrong
if (onRevokeCertResponseError != null)
{
//Request failed, raise the error event
onRevokeCertResponseError(RevokeCertResponse);
}
}
}
catch
{
//Something went wrong
onRevokeCertResponseError(null);
}
}
}
}
Responses JSON, XML
XML Response
<Response xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="Connecter">
<APIVersion>1.0.0</APIVersion>
<ErrorCode>0</ErrorCode>
<ErrorMessage />
<RequestID>2013-08-19 14:07:07.6561311</RequestID>
<ReturnParam1 />
<ReturnParam2 />
<ReturnParam3 />
<Submitted>true</Submitted>
</Response>
JSOn Response
{
"ErrorMessage": "",
"Submitted": true,
"RequestID": "2013-08-19 14:08:12.8457999",
"APIVersion": "1.0.0",
"ReturnParam1": "",
"ReturnParam2": "",
"ReturnParam3": "",
"ErrorCode": 0
}
This version of the RevokeCert command is used to revoke certs from users and teams specified with the ProfileEntity value and the expiration date. The Secret Key must be the App Secret Key.
https://redcritterconnecter.com/services/gamificationv1/RevokeCert?SecretKey={SecretKey}&ExternalAccountID={ExternalAccountID}&ProfileEntity={ProfileEntity}&CertName={CertName}&ExpirationDate={ExpirationDate}
SecretKey | string | yes | This SecretKey is an App Secret Key.The App Domain is determined by the External Account ID you provide. |
ExternalAccountID | string | yes | A unique ID for an App Domain that you create and manage. For example an App could have 2 App Domains managed separately by specifying an ExternalAccountID of 'Sales Dept' or 'IT Dept'. When passed as a parameter if the External Account ID does not exist. RedCritter Connecter will create a new App Domain on the fly with the ID that you specify. |
ProfileEntity | string | yes | The ProfileEntity represents to whom the API call will apply. This can be an email address or a team name. Multiple email addresses or teams can be specified by separating them with a semicolon. Team names can be any string value other than an email address. If a team's profile does not exist, RedCritter will create one dynamically. |
CertName | string | yes | The CertName parameter represents the RedCritter certification you would like to award. The cert must exist to be revoked. The following characters cannot be used : | = [ ] , ; |
ExpirationDate | string | yes | The date that the certification is set to expire. This must match the date listed on the cert in order for the revoke to work properly. |
Code Samples Javascript, C#
RevokeCert with JavaScript
This is a minimal example of calling the RevokeCert API via HTML and Javascript. Remember to never use your Secret Keys on the client side.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.js"></script>
<script type="text/javascript">
var connecterURL = "https://www.redcritterconnecter.com/";
function revokeCert(secretKey, externalAccountID, profileEntity, certName, expirationDate, cbSuccess, cbFail) {
$.getJSON(connecterURL + "services/gamificationv1/revokeCert?jsoncallback=?", { secretKey: secretKey, externalAccountID: externalAccountID, profileEntity: profileEntity, certName: certName, expirationDate: expirationDate },
function (data) {
if (data.Submitted) {
cbSuccess(data);
} else {
cbFail(data);
}
});
}
//My Success Callback
function onMyrevokeCertSuccessHandler(data) {
//data is JSON response
alert("Request was successful");
}
//My Failure Callback
function onMyrevokeCertFailHandler(data) {
//Something went wrong
alert("Something went wrong");
}
</script>
</head>
<body>
<table>
<tr>
<td>Secret Key</td>
<td>
<input type="text" id="tSecretKey" style="width: 500px" />
</td>
</tr>
<tr>
<td>External Account ID</td>
<td>
<input type="text" id="tExternalAccountID" style="width: 500px" />
</td>
</tr>
<tr>
<td>Profile Entity</td>
<td>
<input type="text" id="tProfileEntity" />
</td>
</tr>
<tr>
<td>Cert Name</td>
<td>
<input type="text" id="tCertName" />
</td>
</tr>
<tr>
<td>Expiration Date</td>
<td>
<input type="text" id="tExpirationDate" />
</td>
</tr>
<td></td>
<td>
<input type="button" onclick="revokeCert($('#tSecretKey').val(), $('#tExternalAccountID').val(), $('#tProfileEntity').val(), $('#tCertName').val(), $('#tExpirationDate').val(), onMyrevokeCertSuccessHandler, onMyrevokeCertFailHandler)" value="Revoke Cert" /></td>
</tr>
</table>
</body>
</html>
RevokeCert with C#
This is a minmal example of calling the RevokeCert API and parsing the JSON result into a populated C# object. This example uses asynchronous techniques to raise a callback when the response is received.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.IO;
using System.Web; //Add reference to System.Web
using System.Runtime.Serialization.Json; //Add reference to System.Runtime.Serialization
namespace RedCritterConnecter.Samples
{
//Create a class to contain the response
public class RevokeCertResponse
{
public String ErrorMessage { get; set; }
public Boolean Submitted { get; set; }
public String RequestID { get; set; }
public String APIVersion { get; set; }
public String ReturnParam1 { get; set; }
public String ReturnParam2 { get; set; }
public String ReturnParam3 { get; set; }
private Int32 ErrorCode { get; set; }
}
public class RevokeCert
{
public delegate void OnRevokeCertResponse(RevokeCertResponse RevokeCertResponse);
public event OnRevokeCertResponse onRevokeCertResponse;
public delegate void OnRevokeCertResponseError(RevokeCertResponse RevokeCertResponse);
public event OnRevokeCertResponseError onRevokeCertResponseError;
const string CONST_ConnecterBaseURL = "https://www.redcritterconnecter.com/";
public void Execute(String SecretKey, String ExternalAccountID, String ProfileEntity, String CertName, String ExpirationDate)
{
try
{
//Create url encoded parameters in query string
String queryString = "secretkey=" + System.Web.HttpUtility.UrlEncode(SecretKey) + "&ExternalAccountID=" + System.Web.HttpUtility.UrlEncode(ExternalAccountID) + "&Certname=" + System.Web.HttpUtility.UrlEncode(CertName) + "&profileentity=" + System.Web.HttpUtility.UrlEncode(ProfileEntity) + "&dateissued=" + "&expirationdate=" + System.Web.HttpUtility.UrlEncode(ExpirationDate);
//Create a new instance of a WebClient
WebClient wc = new System.Net.WebClient();
//Prevent this request from caching in order to ensure that it is sent to server
wc.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore);
//Attach an event handler to receive the response
wc.DownloadStringCompleted += onRevokeCertResponseReceived;
//Make the call
wc.DownloadStringAsync(new Uri(CONST_ConnecterBaseURL + "services/gamificationv1/RevokeCert?" + queryString, UriKind.Absolute));
}
catch
{
//Something went wrong communicating with the server
if (onRevokeCertResponseError != null)
{
onRevokeCertResponseError(null);
}
}
}
private void onRevokeCertResponseReceived(object sender, DownloadStringCompletedEventArgs e)
{
try
{
//Create a JSON serializer
System.Runtime.Serialization.Json.DataContractJsonSerializer s = new DataContractJsonSerializer(typeof(RevokeCertResponse));
//Copy the string into a memory stream
MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(e.Result));
//Read the stream into an object matching the response's type
RevokeCertResponse RevokeCertResponse = (RevokeCertResponse)s.ReadObject(ms);
//Work with the populated response object
if (RevokeCertResponse.Submitted == true)
{
//Request was accepted, raise the success event
onRevokeCertResponse(RevokeCertResponse);
}
else
{
//Something went wrong
if (onRevokeCertResponseError != null)
{
//Request failed, raise the error event
onRevokeCertResponseError(RevokeCertResponse);
}
}
}
catch
{
//Something went wrong
onRevokeCertResponseError(null);
}
}
}
}
Responses JSON, XML
XML Response
<Response xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="Connecter">
<APIVersion>1.0.0</APIVersion>
<ErrorCode>0</ErrorCode>
<ErrorMessage />
<RequestID>2013-08-19 14:11:00.3616552</RequestID>
<ReturnParam1 />
<ReturnParam2 />
<ReturnParam3 />
<Submitted>true</Submitted>
</Response>
JSON Resonse
{
"ErrorMessage": "",
"Submitted": true,
"RequestID": "2013-08-19 14:12:01.3481660",
"APIVersion": "1.0.0",
"ReturnParam1": "",
"ReturnParam2": "",
"ReturnParam3": "",
"ErrorCode": 0
}
|
Use |
Runtime |
Method |
HTTP GET |
Invites User |
Yes |
Billable |
Yes |
Response |
JSON,XML |
API Version |
1 |
|