Overview
Each request to the API must contain an authorization header. The authorization header is comprised of the API key and the digital signature for the request. The digital signature is a concatenation of the API key and the action hashed using the API secret.
Details
- URL
- https://partner.follrdev.com/user/
- Method
- GET, POST, PUT
- Authorization
- API key concatenated with the digital signature for the request separated by a colon.
- Example: Authorization: AF2A9060-05DC-4BC0-84FE-C19723428BB9:jXxcnMdbqyAh28Ft0y/3BYZ9jBg=
C# Example
private const string API_KEY = "AF2A9060-05DC-4BC0-84FE-C19723428BB9"; private const string API_SECRET = "6ED66FD2-9010-4F5E-A231-865472BB263E"; public static HttpResponseMessage Get(this HttpClient client, string uri, string acceptContentType, string operation) { HttpRequestMessage request = new HttpRequestMessage("GET", uri); request.Headers.Authorization = new Credential(null, String.Format("{0}:{1}", API_KEY, GetSignature(operation))); request.Headers.Accept.Add(new StringWithOptionalQuality(acceptContentType)); return client.Send(request); } static string GetSignature(string operation) { string rawSignature; string signature; UTF8Encoding encoder; HMACSHA1 hashProvider; rawSignature = String.Concat(API_KEY, operation.ToLower()); encoder = new UTF8Encoding(); hashProvider = new HMACSHA1(encoder.GetBytes(API_SECRET)); signature = Convert.ToBase64String(hashProvider.ComputeHash(encoder.GetBytes(rawSignature.ToCharArray()))); return signature; }
Request
HttpRequestMessage(GET https://partner.follrdev.com/user/read/2UH2MT) Authorization: AF2A9060-05DC-4BC0-84FE-C19723428BB9:jXxcnMdbqyAh28Ft0y/3BYZ9jBg= Accept: application/json
Response
HttpResponseMessage(GET http://localhost:12143/user/read/2UH2MT OK 200) X-AspNetMvc-Version: 1.0 Connection: Close Content-Length: 181 Cache-Control: private Content-Type: application/json; charset=utf-8 Date: Thu, 03 May 2012 17:59:51 GMT Server: ASP.NET Development Server/9.0.0.0 X-AspNet-Version: 2.0.50727 {"Message":"Success","Status":0,"User":{"Email":"johndoe@example.com","FirstName":"John","Id":"2UH2MT","LastName":"Doe","Password":null,"ProfileUrl":"http:\/\/localhost\/John.Doe"}}