Call Trace Service


The Call Trace Service enables callers to obtain information about all API calls that took place within a given time period. For example, you can view the count of queries or mutations of a particular service that were called within a given time period.

This service is a tenant-level service, and, consequently, it returns statistics only for other tenant-level services. To return the list of tenant-level services, run the services query.

Access info

Endpoint https://call-trace-api.socrate.io/graphql
Required access keys Tenant-level service access key
Pricing Please contact us for details at contact@bitsoftware.ro
Notes To call the service, the access key must be provided in the x-api-key header of the HTTP request. If you are using the GraphQL console, you can view the service’s documentation and schema only after entering an access key. Make sure that the scope of the key allows access to the queries and mutations that you require. For example, to grant the key access to all queries and mutations, the keys’s scope must be set to call-trace-api:query:* call-trace-api:mutation:*.

Queries

calls

Returns the count of queries or mutations that were run for a particular service, or for all services.

Arguments

Argument Type Description
filter CallsFilter! Provides filtering options to the query.
nextToken String Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the CallsResult type.
CallsFilter input
Attribute Type Description
from DateTime! Mandatory. The date and time starting with which statistics will be fetched.
to DateTime Optional. The date and time up to which statistics will be fetched, for example, 2024-07-16, 2024-07-15T06:59:59, 2024-07-16T11:30:53.983Z. Note that, if you specify only a date value without time, then the time is considered to be 00:00:00.
service ServiceCode Optional. The service code specifies the service for which you would like to collect statistics. To obtain all available service codes, run the services query.
operationType OperationType Optional. Specifies the operation type for which statistics should be returned. Valid values: query, mutation.
field Field Optional. Specifies the name of the query or mutation for which statistics should be returned.
publicKey ID Optional. Lets you filter calls where a tenant-level service access key (not a token) was used and the public key is the one you supply in this input parameter.
userId ID Optional. Lets you filter calls initiated by a specific SBS Portal User. To filter such calls, supply the ID of the portal user in this input parameter. You can find the ID of an SBS Portal User by running the portalUsers query of the Account API.

Result

CallsResult type
Attribute Type Description
items [CallsValue] The statistics data that matches the filtering options, as an array of items of type CallsValue.
nextToken String If null, then the query has reached the end of the list of results that match the query criteria. If not null, then use this value in the nextToken input argument, with the same filter, to fetch the next set of results.
CallsValue type
Attribute Type Description
service ServiceCode The service code indicates specifies the service for which statistics have been retrieved.
operationType OperationType Specifies the operation type for which statistics have been returned. Valid values: query, mutation.
field Field Specifies the name of the query or mutation for which statistics have been retrieved.
count Float The actual count of calls (queries or mutations) that took place.

Example

The following call returns the count of runs for the sendMessage mutation of the Email Service starting from the 1st of July 2023 up to the current date and time:

query calls ($filter:CallsFilter!){
  calls(filter:$filter) {
    items {
      service
      operationType
      field
      count
    }
  }
}
{
  "filter": {
    "from": "2023-07-01",
    "service": "email-api",
    "field": "sendMessage"
  }
}

services

Returns a list of all services exposed by the Socrate Business Services API. This query is useful when you need to find out the service code of a particular service, for example, when querying usage.

Arguments

None.

Result

An array of service codes.

Example

query services {
  services 
}

version

Returns the API version.