Eagle API Documentation

Eagle API Documentation.

1. Creating a new client_id/client_secret in the software.

  1. Go to “https://www.eagleagent.com.au/agent” and sign-in
  2. Click “Settings” in the top right hand corner.
  3. Click on “API Credentials” on the left hand side navigation bar
  4. Click “New Credentials”
  5. Enter a description for the token. (Example: “My Integration”)
  6. Click “Create”
  7. You will now see an index of all your current tokens. The client secret is hidden by default. Click “show” to display it.

2. Aquiring a session token in order to make requests

The “/api/v3/token” endpoint will allow you to generate a session token that will expire in 24 hours. The “Authorization” header must be your client id, followed by a colon, followed by the client secret.

Using cURL

Example (assuming your client id is “5889796789559” and your client secret is “230408972308020237838”)

Request

  curl \
  -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer 5889796789559:230408972308020237838 \
  https://www.eagleagent.com.au/api/v3/token

Response

  {
    "data": {
      "token":{
        "token":"eyJ0eXAfKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0eXBlIjoiYXBpIiwidXNlcl9jbudjd8ujjasbnl9jb3VudGVyIjoxLCJhZG1pbl9pZCI6bnVsbCwiZXhwIjoxNTgyMjA2NzYzfQ.cOAsAVHoAt8u61nE58ARJgsaLJNq_amSVlgQquRI",
        "expiresAt": 1582206763
      }
    }
  }

3. How to make a GraphQL request using cURL

GraphQL request to get a list of properties

  query GetProperties {
    properties {
      nodes {
        id
        formattedAddress
        latitude
        longitude

        vendors {
          contact {
            firstName
            lastName
          }
        }
      }
    }
  }

using cURL

Request

The authorization header should be “Bearer TOKEN” where “TOKEN” is the session token you received by querying the previous endpoint.

  curl \
  -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer eyJ0eXAfKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0eXBlIjoiYXBpIiwidXNlcl9jbudjd8ujjasbnl9jb3VudGVyIjoxLCJhZG1pbl9pZCI6bnVsbCwiZXhwIjoxNTgyMjA2NzYzfQ.cOAsAVHoAt8u61nE58ARJgsaLJNq_amSVlgQquRI' \
  --data '{ "query": "query GetEmailTemplates { properties { nodes { id formattedAddress latitude longitude vendors { contact { firstName lastName } } } } }" }' \
  https://www.eagleagent.com.au/api/v3/graphql

Response

  {
    "data": {
        "properties": {
            "nodes": [{
                    "id": "1",
                    "formattedAddress": "1366 May Locks, EUROA",
                    "latitude": 51.7247413420192,
                    "longitude": 77.0944799310262,
                    "vendors": []
                }, {
                    "id": "3",
                    "formattedAddress": "4831 Konopelski Summit, EUROA",
                    "latitude": 59.8443803028871,
                    "longitude": -20.4846786912621,
                    "vendors": []
                }
            }
        }
    }
  }

Mutation Example

curl 'https://www.eagleagent.com.au/api/v3/graphql' \

  -H 'eyJ0eXAfKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0eXBlIjoiYXBpIiwidXNlcl9jbudjd8ujjasbnl9jb3VudGVyIjoxLCJhZG1pbl9pZCI6bnVsbCwiZXhwIjoxNTgyMjA2NzYzfQ.cOAsAVHoAt8u61nE58ARJgsaLJNq_amSVlgQquRI' \
  -H 'Content-Type: application/json' \
  -H 'Origin: https://www.eagleagent.com.au' \
  --data-binary $'{"query":"mutation CreateTaskMutation($associations: [AssociationAttributes\u0021], $body: String\u0021, $dueDate: String\u0021) {\\n  createTask(input: { attributes: { associations: $associations, body: $body, dueDate: $dueDate }}) {\\n\\t\\terrors\\n    \\n    task {\\n      id\\n      body\\n    }\\n  }\\n}","variables":{"associations":[{"associationId":8,"associationType":"CONTACT"}],"body":"This is the body of the note","dueDate":"2021-03-03T10:10:10 +10000"},"operationName":"CreateTaskMutation"}' \
  --compressed

Response

{
  "data": {
    "createTask": {
      "errors": [],
      "task": {
        "id": "1181673",
        "body": "This is the body of the note"
      }
    }
  }
}

For full details on our graphql API please refer to the documentation below

https://api.eaglesoftware.com.au/v3

For more information on GraphQL please visit the following

https://graphql.org/learn/ GraphQL Principles

https://www.youtube.com/watch?v=k4TPrzH-AXA Consuming GraphQL APIs