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.
Example (assuming your client id is “5889796789559” and your client secret is “230408972308020237838”)
curl \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer 5889796789559:230408972308020237838 \
https://www.eagleagent.com.au/api/v3/token
{
"data": {
"token":{
"token":"eyJ0eXAfKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0eXBlIjoiYXBpIiwidXNlcl9jbudjd8ujjasbnl9jb3VudGVyIjoxLCJhZG1pbl9pZCI6bnVsbCwiZXhwIjoxNTgyMjA2NzYzfQ.cOAsAVHoAt8u61nE58ARJgsaLJNq_amSVlgQquRI",
"expiresAt": 1582206763
}
}
}
query GetProperties {
properties {
nodes {
id
formattedAddress
latitude
longitude
vendors {
contact {
firstName
lastName
}
}
}
}
}
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
{
"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": []
}
}
}
}
}
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
{
"data": {
"createTask": {
"errors": [],
"task": {
"id": "1181673",
"body": "This is the body of the note"
}
}
}
}
https://api.eaglesoftware.com.au/v3
https://graphql.org/learn/ GraphQL Principles
https://www.youtube.com/watch?v=k4TPrzH-AXA Consuming GraphQL APIs