Danlon API
Table of Contents
General Information
Danlon API is a wrapper service for Danlon that provides GraphQL API representing Danlon functionality and data.
Authentication
For authentication, you will first have to get a refresh_token for a user by connecting your system to Danløn Integration. Once you have a refresh_token you can access the API by getting an access_token using the token endpoint in Danløns Authentication Service.
An example request using curl:
curl --location --request POST 'https://auth.danlon.dk/auth/realms/danlon/protocol/openid-connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id={client_id}' \
--data-urlencode 'client_secret={client_secret}' \
--data-urlencode 'grant_type=refresh_token' \
--data-urlencode 'refresh_token={refresh_token}'
Replace curly brackets with your values.
Afterwards you will get a short living (5 minutes) access token for the user that the refresh_token was given by. Use the access token in the header of the requests as a Bearer token.
GraphQL API
In this section you can find the most frequently used endpoints of GraphQL API. You can also use GraphQL prepared requests by clicking on the GraphiQL links.
To authenticate your request, use the token created according to the instruction above.
Getting Companies and Employees
{
companiesExt(input: {companyIds: ["MV8x"]}) {
companies {
id
name
vatId
address {
street
street2
postalCode
city
countryCode
country
}
employees(input: {
employeeIds:["MV8xXzE="]
}) {
employees {
id
active
domainId
name
email
birthDate
address {
street
street2
postalCode
city
countryCode
country
}
employment {
beginDate
endDate
jobTitle
paymentType
paymentTime
salary
hourlyRate
hoursPerWeek
specialDaysOff
pensionCorporate
pensionEmployee
}
payParts {
payParts {
id
code
units
rate
amount
}
}
}
}
payParts {
payParts {
id
code
units
rate
amount
employee {
id
name
}
company {
id
name
}
}
}
}
}
}
Click here to open this query in GraphiQL tool
Fetching PayPart Meta
{
payPartsMeta {
payPartsMeta {
code
description
unitsAllowed
rateAllowed
amountAllowed
}
}
}
Click here to open this query in GraphiQL tool
Creating PayParts
mutation {
createPayParts(input: {
companyId: "MV8x",
payParts: [
{
employeeId: "MV8xXzE=",
code: "T1",
units: 1,
rate: 1000,
amount: 2000
}
]
}) {
createdPayParts {
id
code
units
rate
amount
employee {
id
name
email
}
company {
id
name
}
}
}
}
Click here to open this mutation in GraphiQL tool