Messages
GraphQL interface for messages.
enum MESSAGE_SENT_BY {
ADMIN
CANDIDATE
}
type MessageAttachment {
id: String
name: String
resourcePath: String
type: String
size: Int
}
type Message {
id: String
candidateId: String
sentBy: MESSAGE_SENT_BY
userId: String
text: String
user: User
replyToMessageId: String
isRead: Boolean
attachments: [MessageAttachment]
}
input MessageFilterPaging {
filter: MessageFilter
paging: GraphPaging
sort: GraphSorting
}
input MessageFilter {
candidateId: String
contactId: String
listingId: String
}
type Query {
messages(input: MessageFilterPaging): [Message]
}
Usage of Query:
GraphQL
CURL
Javascript
Query:
query message($candidateId: String, $contactId: String, $externalContactId: String, $listingId: String) {
messages(
input: {
filter: {
candidateId: $candidateId
contactId: $contactId
externalContactId: $externalContactId
listingId: $listingId
}
}
) {
id
candidateId
sentBy
text
isRead
attachments {
id
name
resourcePath
type
size
}
}
}
Variables:
Using either of these 3 should give an error if no variables not given.
{
"candidateId": "a50ddf78-c792-4461-b77e-c36ec444ddb5",
"contactId": "6aec3680-a1de-4e5b-b3d9-67cb4b4727f6",
"listingId": "1840826c-08aa-419c-9779-c0a0dfcbd190"
}
Should look something like this in Postman
curl --location --request POST 'https://acme-qa.everreal-dev.co/api/reporting/graphql' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI4NzYyNzE1MC1lZDM0LTQ3YjUtYWE0Zi00NWIyM2M4ZWI4MTYiLCJzdWIiOiI5NDQ0YzYzYy0wZmU2LTQ2YzAtYjUxMy1mOTU5YmY3YTI4YjkiLCJleHAiOjE2NTI2OTkwMDQsImlhdCI6MTY1MjY5NTQwNH0.mpAv2oUYU4PSYW1Z10bzz4wU0axr2CqDntV_lZMyrd0H0iFM7Ul3Co6xRnjcsnEqpI_4itkSeeStQH1wTXw_FWFAe3HB7cto2mndFZqZn-P0ZtA-Xfmb7nB8Gpm3vY8hNyjJkhznxMUKXeHzHp2yYISREl7oUK62v1HE2ameBA7PHmD_KuFMUJ6bzuZ_Iz6kEz5hE45wJMNbfsj0N369NOjt12dYsDu-7qR9t_KywZYB9JV6zllYZuhvycGOMfdPRB1qn39L2Xka-XwD5959wew0cYr5QLgFFdIUWtVWQLQXbib5CD1lNA5nGNeeUwLzm5sgD3xEJlG-4oGymEr1eg' \
--header 'Content-Type: application/json' \
--data-raw '{"query":"query message($candidateId: String, $contactId: String, $externalContactId: String, $listingId: String) {\n messages(\n input: {\n filter: {\n candidateId: $candidateId\n contactId: $contactId\n externalContactId: $externalContactId\n listingId: $listingId\n }\n }\n ) {\n id\n candidateId\n sentBy\n text\n isRead\n attachments {\n id\n name\n resourcePath\n type\n size\n }\n }\n }","variables":{"candidateId":"a50ddf78-c792-4461-b77e-c36ec444ddb5","contactId":"6aec3680-a1de-4e5b-b3d9-67cb4b4727f6","listingId":"1840826c-08aa-419c-9779-c0a0dfcbd190"}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI4NzYyNzE1MC1lZDM0LTQ3YjUtYWE0Zi00NWIyM2M4ZWI4MTYiLCJzdWIiOiI5NDQ0YzYzYy0wZmU2LTQ2YzAtYjUxMy1mOTU5YmY3YTI4YjkiLCJleHAiOjE2NTI2OTkwMDQsImlhdCI6MTY1MjY5NTQwNH0.mpAv2oUYU4PSYW1Z10bzz4wU0axr2CqDntV_lZMyrd0H0iFM7Ul3Co6xRnjcsnEqpI_4itkSeeStQH1wTXw_FWFAe3HB7cto2mndFZqZn-P0ZtA-Xfmb7nB8Gpm3vY8hNyjJkhznxMUKXeHzHp2yYISREl7oUK62v1HE2ameBA7PHmD_KuFMUJ6bzuZ_Iz6kEz5hE45wJMNbfsj0N369NOjt12dYsDu-7qR9t_KywZYB9JV6zllYZuhvycGOMfdPRB1qn39L2Xka-XwD5959wew0cYr5QLgFFdIUWtVWQLQXbib5CD1lNA5nGNeeUwLzm5sgD3xEJlG-4oGymEr1eg");
myHeaders.append("Content-Type", "application/json");
var graphql = JSON.stringify({
query: "query message($candidateId: String, $contactId: String, $externalContactId: String, $listingId: String) {\n messages(\n input: {\n filter: {\n candidateId: $candidateId\n contactId: $contactId\n externalContactId: $externalContactId\n listingId: $listingId\n }\n }\n ) {\n id\n candidateId\n sentBy\n text\n isRead\n attachments {\n id\n name\n resourcePath\n type\n size\n }\n }\n }",
variables: {"candidateId":"a50ddf78-c792-4461-b77e-c36ec444ddb5","contactId":"6aec3680-a1de-4e5b-b3d9-67cb4b4727f6","listingId":"1840826c-08aa-419c-9779-c0a0dfcbd190"}
})
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: graphql,
redirect: 'follow'
};
fetch("https://acme-qa.everreal-dev.co/api/reporting/graphql", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Copy link