General
Results can be returned in either XML or JSON format depending upon the supplied Accept HTTP header (application/xml or application/json).
Before you will be able to request data through the API you will need to be provided with an IntegrationPartnerID and an APIKey from ResMan. These two values will be the unique credentials for your company and will give you access to data stored in ResMan. Note that these will be used for all requests regardless of the property or account for which you are requesting data.
In addition to your IntegrationPartnerID and APIKey you will need to provide the AccountID and PropertyID for the account and property of which you are requesting data. Upon request you will be supplied with each shared client’s AccountID and PropertyID.
Request Example
Data is requested by performing a HTTP Post to the indicated method supplying the parameters in the body of the request. The following demonstrates one way of submitting a request to a method using C#.
// Setup the request
HttpWebRequest request = WebRequest.Create([ResMan API Method Url]) as HttpWebRequest;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
// Define how you want the results returned (“application/json” or “application/xml”)
request.Accept = "application/json";
// Add the needed parameters
StringBuilder parameters = new StringBuilder();
// Integration Partner values
parameters.Append("IntegrationPartnerID=100");
parameters.Append("&ApiKey=6aw7y9m3m04849lqld6em9sudl5fg01u");
// Account and property specific data
parameters.Append("&AccountID=400");
parameters.Append("&PropertyID=07413576-f764-44c6-be35-df4139deec01");
// Encode the parameters as form data
byte[] formData = UTF8Encoding.UTF8.GetBytes(parameters.ToString());
request.ContentLength = formData.Length;
// Send the request
using (Stream post = request.GetRequestStream())
{
post.Write(formData, 0, formData.Length);
}
// Get the response
string result = null;
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
StreamReader reader = new StreamReader(response.GetResponseStream());
result = reader.ReadToEnd();
}