Endpoints
Get endpoints
Query endpoints()
allows to get a list of endpoints where notifications can be sent to.
endpoints(filter: JSON = null
ids: [ID] = null
limit: Int = null
offset: Int = null
order: [String] = null
withArchived: WithArchived = null): EndpointCollection!
filter: JSON
: You can filter a list of endpoints by specifying one or several parameters:
creation_date
: Exact endpoint creation date in ISO 8601 formatid
: ID assigned to endpoint from the databaseis_active
:last_modified
: Exact date of the last endpoint modification in ISO 8601 formatmeta
: JSON that contains the data for reaching an endpointtriggers
: ID assigned to a trigger that activates notificationstype
: The parameter sorts the endpoints by type (WI = WebInterface
,EM = Email
,WH = Webhook
)workspace
: Workspace IDworkspace_id
: Workspace ID
ids: [ID]
: To get a list with certain endpoints, specify their IDs in the list.
limit: Int
: The parameter allows to get the first n
profiles from the list.
offset: Int
: The parameter allows to remove the first n
profiles from the list.
order: [String]
:
withArchived: WithArchived
: To get all endpoints including the archived ones, specify all
. To get only archived endpoints, specify archived
.
EndpointCollection!
:Query result is a list of endpoints that contains the following parameters:
totalCount
: Number of returned endpointsprofiles: [EndpointOutput!]!
:id: ID!
: Endpoint IDtype: EndpointType!
: Endpoint type can have the following values:Email
,Webhook
orWebInterface
meta: JSONString!
: Endpoint meta-information for reaching this endpointlastModified: DateTime!
: Last endpoint modification date in ISO 8601 formatcreationDate: DateTime!
: Endpoint creation date in ISO 8601 formatdefaultAlias: DefaultAlias
:OWNER_EMAIL
WEB_INTERFACE
archived: Boolean!
: Attribute that the endpoint is archived.
Example Request:
{
endpoints(ids: ["6fd67f81-a195-442b-a991-1a0eca6bbb69"]) {
totalCount
collectionItems {
archived
creationDate
id
defaultAlias
lastModified
meta
type
}
}
}
Example Response:
API returns the following result:
{
"data": {
"endpoints": {
"totalCount": 1,
"collectionItems": [
{
"archived": false,
"creationDate": "2022-07-07T07:21:06.421413+00:00",
"id": "6fd67f81-a195-442b-a991-1a0eca6bbb69",
"defaultAlias": "OWNER_EMAIL",
"lastModified": "2022-07-07T07:21:06.421425+00:00",
"meta": "{\"target_email\": \"aa@aa.ru\", \"default_alias\": \"owner_email\"}",
"type": "Email"
}
]
}
}
}
Create an email endpoint
Mutation createEmailEndpoint()
allows to create a new endpoint of Email
type.
createEmailEndpoint(endpointData: EmailEndpointInput!): EndpointManageOutput!
endpointData: EmailEndpointInput!
: JSON with the information required for creating an endpoint:
targetEmail: String!
: Email where notifications will be sent to.
EndpointManageOutput!
: The mutation result is JSON that contains the following parameters:
ok: Boolean!
: Attribute that mutation is successfully completedendpoint: EndpointOutput!
: New endpoint object
Example Request:
mutation {
createEmailEndpoint(endpointData: {targetEmail: "test@test.com"}) {
ok
endpoint {
id
archived
creationDate
defaultAlias
lastModified
meta
type
}
}
}
Example Response:
API returns the following result:
{
"data": {
"createEmailEndpoint": {
"ok": true,
"endpoint": {
"id": "2eff291d-8c8c-4325-8953-5a70b31bc63e",
"archived": false,
"creationDate": "2022-07-10T12:27:22.568988+00:00",
"defaultAlias": null,
"lastModified": "2022-07-10T12:27:22.569003+00:00",
"meta": "{\"target_email\": \"test@test.com\"}",
"type": "EMAIL"
}
}
}
}
Create a webhook endpoint
Mutation createWebhookEndpoint()
allows to create a new endpoint of Webhook
type.
createWebhookEndpoint(endpointData: WebhookEndpointInput!): EndpointManageOutput!
endpointData: WebhookEndpointInput!
: JSON with the information required for creating an endpoint:
url: String!
: URL where requests will be sent torequestMethod: String!
: Request method
EndpointManageOutput!
: The mutation result is JSON that contains the following parameters:
ok: Boolean!
: Attribute that mutation is successfully completedendpoint: EndpointOutput!
: New endpoint object
Example Request:
mutation {
createWebhookEndpoint(endpointData: {url: "https://endpoint_test.requestcatcher.com/test /", requestMethod: "POST"}) {
ok
endpoint {
archived
creationDate
defaultAlias
id
lastModified
meta
type
}
}
}
Example Response:
API returns the following result:
{
"data": {
"createWebhookEndpoint": {
"ok": true,
"endpoint": {
"archived": false,
"creationDate": "2022-07-10T12:42:34.957171+00:00",
"defaultAlias": null,
"id": "afd7c121-3140-4a8c-b0ee-3717581eb76d",
"lastModified": "2022-07-10T12:42:34.957188+00:00",
"meta": "{\"url\": \"https://endpoint_test.requestcatcher.com/test /\", \"method\": \"POST\"}",
"type": "WEBHOOK"
}
}
}
}
Update an endpoint
Mutation updateEndpoint()
allows to update the endpoint information.
updateEndpoint(endpointId: ID!
endpointInfo: JSON): EndpointManageOutput!
endpointId: ID!
: Endpoint ID
endpointInfo: JSON
: JSON-object with parameters to be updated. These parameters are similar to the parameters from meta: JSON
EndpointManageOutput!
: The mutation result is JSON that contains the following parameters:
ok: Boolean!
: Attribute that mutation is successfully completedendpoint: EndpointOutput!
: Updated endpoint object
Incorrect input errors:
- Endpoint not found by transmitted id:
{
"message": "Endpoint matching query does not exist."
}
Example Request:
mutation {
updateEndpoint(endpointId: "6fd67f81-a195-442b-a991-1a0eca6bbb69", endpointInfo: {target_email: "new-email@test.com"}) {
ok
endpoint {
id
meta
}
}
}
Example Response:
API returns the following result:
{
"data": {
"updateEndpoint": {
"ok": true,
"endpoint": {
"id": "6fd67f81-a195-442b-a991-1a0eca6bbb69",
"meta": "{\"target_email\": \"new-email@test.com\", \"default_alias\": \"owner_email\"}"
}
}
}
}
Delete an endpoint
Mutation deleteEndpoint()
is used to archive a list of endpoints.
deleteEndpoint(endpointIds: [String!]!): MutationResult!
endpointIds: [String!]!
: List of endpoint IDs
MutationResult!
: The mutation result is JSON that contains the following parameters:
ok: Boolean!
: Attribute that mutation is successfully completed
Example Request:
mutation {
deleteEndpoint(endpointIds: ["2eff291d-8c8c-4325-8953-5a70b31bc63e", "29bcfb3a-3a26-4544-9def-d5d44bbd3be4"]) {
ok
}
}
Example Response:
API returns the following result:
{
"data": {
"deleteEndpoint": {
"ok": true
}
}
}