How to Integrate with Eagle
What do you need?
To use the Eagle API you need a client_id. To get a client_id, send an email to Eagle with the following information:
- Your client_id needs at least 5 characters, without spaces or symbols.
Scope: EagleWrite of EagleRead
- Technical contact: name, email and phone number
After this request we'll send you a Client Secret to test your integration on our Beta environment. As soon as your tests are successfully completed, you can send us a request to put the client_id into production.
Collecting a token via Eagle STS
To be able to access the Eagle API you need a token (bearer), which you can request from the Eagle STS using your client_id, client_secret and the desired scope.
Below an example (c#) of a request operation to request a token:
static TokenResponse GetClientToken()
{
var client = new TokenClient(
"https://beta-backend.eaglebe.com/connect/token",
"client_id",
"client_secret");
return client.RequestClientCredentialsAsync("Scope").Result;
}Calling Operation in Eagle API
After you have received an access token you can use it to invoke an operation in the Eagle API.
Below is an example (c#) that shows you how to call an operation in the API:
static async Task< string > CallApi(TokenResponse response)
{
var client = new HttpClient();
//Gebruik de aangevraagde token
client.SetBearerToken(response.AccessToken);
var myContact = JsonConvert.DeserializeObject({...});
var result = await client.PostAsync("https://beta-api.eaglebe.com/v2.0/Permits/Contact/Create",
new StringContent(JsonConvert.SerializeObject(myContact).ToString(), Encoding.UTF8, "application/json"));
if (result.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject(result.Content.ReadAsStringAsync().Result);
}
else
{
return string.Format({0}: {1}, result.StatusCode, result.Content.ReadAsStringAsync().Result;
}
}