In this article, you will learn how to correctly send your API requests to the MeasureSquare Cloud API.
This article applies to MeasureSquare Cloud.
Measure Square requires multiple parameters from third-party solution providers who wish to integrate with Measure Square's Cloud API. In addition a standard API key, the solution provider will need a secret key and will be required to provide three new parameters in every request.
Locate your API Key
If you already have an API key, you may locate it by accessing your MeasureSquare Cloud account and navigating to
Group Management > Group Setting > API Key. If you do not already have an API key, please contact the Measure Square Support team at
support@measuresquare.com or over the phone at (626) 683-9188.
Use HTTP Basic Authentication protocol by doing the following:
- Base64-encode your API key
- Add the encoded API key to your HTTP request header named "Authorization": "Basic [your Base64-encoded API key here]"
Receive your X-Application & Secret Key
Contact Measure Square at
integration@measuresquare.com to receive both the
X-Application and
secret key for your application. These advanced credentials will be associated with the application itself, regardless of user. Even if multiple API keys are used with your application, the advanced credentials should be used for all API requests.
The three required parameters are listed below, along with descriptions. Please be aware that they should be provided in your HTTP request header.
- X-Application: String associated with your application
- X-Timestamp: Current Unix timestamp
- X-Signature: Unique signature generated by using both the secret key and timestamp string to generate a HMAC-SHA256 signature. This must be base 64-encoded.
Note: As best practice, the timestamp should always be current, because the Cloud API will reject requests with a timestamp older than five minutes.
Example
Below is an example of an API request containing the required X-headers written in C#:
- var client = new HttpClient();
- var request = new HttpRequestMessage(HttpMethod.Get, "https://cloud.measuresquare.com/api/projects/06113fe339134a068971329d11f943g28"); // Call Get Project API endpoint
- request.Headers.Add("X-Application", "SampleApplication");
- request.Headers.Add("X-Timestamp", "1751916708");
- request.Headers.Add("X-Signature", "GQe5g/P2KsAhDGLMM7FfyOCPzO1uaWBYfpGJcWyeWP8=");
- request.Headers.Add("Authorization", "Basic ZALjY3IyNzbxNeE0NDcwQmI1MzY2MGNPrTIxNmU7QXm=");
- var response = await client.SendAsync(request);
- response.EnsureSuccessStatusCode();
- Console.WriteLine(await response.Content.ReadAsStringAsync());