What is REST?
Read the Wiki Version or to make it simple, REST API defines a set of functions to which developers can perform requests and receive data responses. The interaction is performed via the HTTP protocol. An advantage of such an approach is the wide usage of HTTP. That is why REST API can be used practically for any programming language.
- You access the Method Response by sending an HTTP request to the Red Rook Billing and Registration API server. The server replies with a response that contains an HTTP status code, the data you requested, or both.
- All methods may return different HTTP status codes (e.g., HTTP Status Code 200 for success response or HTTP Status Code 400 for the bad request).
REST API Request Structure
All URLs in REST API have the following base URL: https://registration.theredrook.com
The method you want to call should be appended to the base URL. For instance, if you want to execute FindAccount(), you would structure the URL as follows:
Required parameters of the method being called will be supplied in the querystring following a "?" symbol. In the case above, the supplied parameter key "EmailAddress" was requested with the value "firstname.lastname@example.org".
Read more on each of the available methods here.
Parameters with string type will have a limit on the number of characters that may be passed to it. If the value provided exceeds the requested value, the value will be accepted with only the characters prior to the field limit.
Red Rook Registration and Billing API uses basic authenticate over SSL to access the service. Username and Password to include in your requests will be provided after Red Rook development partner status has been achieved.
Example: C# .NET 4.5
Using System.Net; WebRequest C5RegistrationRequest = WebRequest.Create("https://registration.theredrook.com/methodname?parameter_key=value"); string userName = "C5User"; string userPassword = "C5Password"; string authInfo = Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(userName + ":" + userPassword)); C5RegistrationRequest.Headers["Authorization"] = "Basic " + authInfo; var Response = C5RegistrationRequest.GetResponse();
The API supports the response in only JSON format.
The API returns HTTP status code 400 (Bad Request) whenever an error occurs. A JSON response will also include an explanation for the error under the key "Error".
In chrome developer tools, you will see the JSON error message in the response and the console will reveal the HTTP Status code.