Skip to main content

GraphQL API - Examples

Updated over 7 months ago

Carerix GraphQL API

All requests are POST requests to https://api.carerix.io/graphql/v1/graphql

Employee

Get employee nr 2:

query {
crEmployee(_id: 2) {
lastName
firstName
employeeID
}
}

Get a list of employees:

query {
crEmployeePage(
qualifier: "toStatusNode.parentNodes.value = 'CandidateActiveTag'"
) {
items {
lastName
employeeID
}
}
}

Modify an employee, using variables:

QUERY:

mutation ($id: ID!, $request: CREmployeeRequest!) {
crEmployeeUpdate(_id: $id, request: $request) {
_id
}
}

GRAPHQL VARIABLES:

{
"id": "1",
"request": {
"_kind": "CREmployee",
"lastName": "Smith"
}
}

Publication

List publication feed:

Change the startdate to today, and the enddate to tomorrow.

query  {  crPublicationPage(    
qualifier: "publicationStart <= (NSCalendarDate) '2024-11-08 23:59:59' AND (publicationEnd > (NSCalendarDate) '2024-11-09 00:00:00' OR publicationEnd = nil) AND toMedium.code = 'web'"
){
items{
_id
}
}
}

A different setup, based on statusses and other checks:

query  {
crPublicationPage(
qualifier: "publicationStart <= (NSCalendarDate) '2024-11-08 23:59:59' AND (publicationEnd > (NSCalendarDate) '2024-11-09 00:00:00' OR publicationEnd = nil) AND toStatusNode.parentNodes.value != 'PublicationStoppedTag' AND toStatusNode.parentNodes.value != 'PublicationToBeStoppedTag' AND toStatusNode.parentNodes.value != 'PublicationPublishFailedTag' AND toVacancy.isOpenApplication = 0 AND toVacancy.deleted = 0"
){
items{
_id
}
}
}

Employee/apply

QUERY:

mutation (
$dedupe: Boolean
$pub: ID
$request: CREmployeeRequest!
) {
crEmployeeApply(
dedupe: $dedupe
pub: $pub
request: $request
) {
_id
}
}

GRAPHQL VARIABLES:

{
"dedupe": true,
"pub": 15,
"request": {
"_kind": "CREmployee",
"lastName": "Smith",
"emailAddress": "example@email.com",
"firstName": "Joe",
"phoneNumber":"+31612345678",
"attachments": {
"items":[
{
"_kind" : "CRAttachment",
"filePath":"CV.pdf",
"label":"Cv Joe",
"toTypeNode":{
"_kind":"CRDataNode",
"_lookup":{
"key":"tag",
"value":"CVTag"
}
},
"content":"CONTENT"
}
]
},
"workHistories":{
"items":[
{
"_kind":"CRWorkHistory",
"employer":"My first employer"
},
{
"_kind":"CRWorkHistory",
"employer":"My second employer"
}
]
},
"matches":{
"items":[
{
"_lookup":{
"key":"publicationID",
"value":15
},
"_kind":"CRMatch",
"notes":"a match note"
}
]
}
}
}

Match

Change a matchstage, using variables:

QUERY:

mutation ($_id: ID!, $request: CRMatchRequest!) {
crMatchUpdate(_id: $_id,request: $request) {
_id
}
}


GRAPHQL VARIABLES:

{
"_id": "1.2",
"request": {
"_kind": "CRMatch",
"statusInfo": {
"_kind":"CRStatusInfo",
"_id": 267
},
"notes":"note"
}
}

Tables/Lists/DataNodes

All standard lists in Carerix are sets of datanodes. All these list have a type. Those types are of the entity CRNodeType. To see all lists use something like:

query {
crNodeTypePage {
items {
_id
identifier
}
}
}

or with a qualifier:

{
"_kind": "CRNodeType",
"qualifier": "identifier like '*status*'"
}

When you know the id of the list type, all list items are retrieved like this:

query{
crDataNodePage(
qualifier: "type.typeID=42"
) {
totalElements
items {
_id
type {
identifier
}
value
}
}
}

AdditionalInfo

Custom, free fields in Carerix are in a dictionary called 'additionalInfo'. All free fields are in this dictionary.

Changing the value of one free field is done with 'additionalInfoPartial'. Below code will change field '10126' to value '123'

    "additionalInfoPartial": {
"_10126": "123"
}

Below code will empty field '10126'

  "additionalInfoPartial": {
"_10126": ""
}

Did this answer your question?