Access info
|
|
Endpoint |
https://document-log-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 document-log-api:query:* document-log-api:mutation:* . |
Usage
The Document Log Service enables calling applications to log various events. The service provides the ability to capture multiple categories of data, namely:
- Document ID (for example, the ID of an invoice)
- Document type (for example, for invoices the document type could be “invoice”)
- The date and time when the log event occurred
- Attribute (for example, the field “Address” on an invoice)
- Old and new values of some attribute (for example, you may log the value of the field “Address” before and after it was changed)
- Author (captures details about the person who took the logged action)
- Action (the actual action that took place, for example “create”, “update”, or “delete”)
- Event source (for example, the application or module/component from where the log originates)
- Event location (for example, the IP address of the computer involved in the logged event)
- Comment (some notes about the event that you would like to store)
- Custom field 1 (a custom field to be used at your discretion)
- Custom field 2 (a custom field to be used at your discretion)
When logging an event, most of the fields above are optional. The only mandatory fields are Document ID, Document type, and the date and time when the log event occurred.
The service provides the ability to log, update, and retrieve logged data in any of the following ways:
- To create a single log record for some event, use the
createLog
mutation.
- To create a batch of log records in a single operation, use the
createLogBatch
mutation.
- To create a batch of log records that all pertain to the same document (single-document log), use the
createSingleDocumentLogs
mutation.
- To retrieve and optionally filter the created logs, use the
logs
query.
- To update existing logs, use the
updateLog
mutation. The updatable fields are Comment, Custom field 1, and Custom field 2.
Queries
logs
Arguments
Argument |
Type |
Description |
filter |
LogsFilter |
Optional. Provides options for filtering the query results. |
nextToken |
String |
Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the LogsResult type. |
Attribute |
Type |
Description |
documentType |
String |
Optional. If provided, the result will contain only logs having this document type. |
documentId |
String |
Optional. If provided, the result will contain only logs having this document ID. |
authorId |
String |
Optional. If provided, the result will contain only logs having this author ID. |
dateTime |
DateFilter |
Optional. If provided, the result will contain only logs that occurred within this temporal range. |
id |
String |
Optional. If provided, the result will contain only the log with this ID. |
attributeId |
String |
Optional. If provided, the result will contain only logs having this attributeID. |
action |
String |
Optional. If provided, the result will contain only logs having this action. |
custom1 |
String |
Optional. If provided, the result will contain only logs filtered by this custom field. |
custom2 |
String |
Optional. If provided, the result will contain only logs filtered by this custom field. |
Attribute |
Type |
Description |
from |
String |
Provides the starting date and time of the range. |
to |
String |
Provides the end date and time of the range. |
Result
LogsResult
type
Attribute |
Type |
Description |
items |
[Log] |
An array of Log objects matching the filter criteria. |
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. |
Log
type
Attribute |
Type |
Description |
id |
ID |
The unique identifier of the log record. |
documentId |
ID |
The unique identifier of the document associated with this log. |
documentType |
String |
The document type associated with this log. |
attributeId |
ID |
The identifier of the attribute associated with this log. |
attribute |
Attribute |
The attribute object associated with this log. |
attributeNewValue |
Value |
The attribute value after the log event. |
attributeOldValue |
Value |
The attribute value before the log event. |
dateTime |
DateTime |
The date and time when the log event occurred. Not to be confused with createdAt field (see below). |
authorId |
ID |
The unique identifier of the log’s author. |
author |
Author |
The actual author object associated with this log. |
eventSource |
EventSource |
This object provides details about the source of the log event. |
eventLocation |
EventLocation |
This object provides details about the location of the log event. |
comment |
String |
A comment with additional information about the log record. |
custom1 |
String |
A custom field with additional information about the log record. |
custom2 |
String |
A custom field with additional information about the log record. |
action |
String |
Provides details about some action that took place. |
createdAt |
DateTime |
The date and time when the log record was created in SBS. |
updateAt |
DateTime |
The date and time when the log record was updated in SBS. |
Attribute
type
Attribute |
Type |
Description |
id |
ID |
The unique identifier of the attribute record. |
name |
Name |
The name of the attribute. |
Value
type
Attribute |
Type |
Description |
raw |
String |
The raw representation of the value. |
display |
String |
The representation of the value suitable for display in an application. |
Author
type
Attribute |
Type |
Description |
id |
ID |
The author’s unique identifier. |
name |
String |
The author’s name. |
profile |
String |
The author’s profile information. |
EventSource
type
Attribute |
Type |
Description |
id |
ID |
The unique identifier of the event source. |
name |
Name |
The name of the event source. |
EventLocation
type
Attribute |
Type |
Description |
id |
String |
The IP address associated with the log event. |
geoLocation |
[Float] |
This is an array of two values [longitude, latitude] that identifies the geographical location of the recorded event in decimal degrees notation. For example, [40.848447, -73.856077]. |
version
Returns the API version.
Mutations
createLog
Logs an event.
Arguments
Attribute |
Type |
Description |
input |
CreateLogInput! |
Mandatory. Provides input data to the mutation. |
Attribute |
Type |
Description |
documentId |
ID! |
Mandatory. The identifier of the document to which the log pertains (for example, an invoice ID). |
documentType |
String! |
Mandatory. The document type as it is defined in your ERP application’s taxonomy. |
dateTime |
DateTime! |
Mandatory. The date and time when the event occurred. |
attribute |
AttributeInput |
Optional. The attribute object associated with this log. |
attributeNewValue |
ValueInput |
Optional. The attribute value after the log event. |
attributeOldValue |
ValueInput |
Optional. The attribute value before the log event. |
author |
AuthorInput |
Optional. The actual author object associated with this log. |
eventSource |
EventSource |
Optional. This object captures details about the source of the log event. |
eventLocation |
EventLocation |
Optional. This object captures details about the location of the log event. |
comment |
String |
Optional. A comment with additional information about the log record. |
custom1 |
String |
Optional. A custom field with additional information about the log record. |
custom2 |
String |
Optional. A custom field with additional information about the log record. |
action |
String |
Optional. Captures details about the action that took place. |
Attribute |
Type |
Description |
id |
ID |
The unique identifier of the attribute record. |
name |
Name |
The name of the attribute. |
Attribute |
Type |
Description |
raw |
String |
The raw representation of the value. |
display |
String |
The representation of the value suitable for display in an application. |
Attribute |
Type |
Description |
id |
ID |
The author’s unique identifier. |
name |
String |
The author’s name. |
profile |
String |
The author’s profile information. |
Attribute |
Type |
Description |
id |
ID |
The unique identifier of the event source. |
name |
Name |
The name of the event source. |
Attribute |
Type |
Description |
id |
String |
The IP address associated with the log event. |
geoLocation |
[Float] |
An array of two values [longitude, latitude] that identifies the geographical location of the log event. For example, [40.848447, -73.856077]. |
Result
CreateLogResult
type
Attribute |
Type |
Description |
item |
Log |
The created log record’s details. |
itemId |
ID |
The id of the created log record. |
createLogBatch
Logs a batch of events.
Arguments
Attribute |
Type |
Description |
input |
CreateLogInput! ! |
Mandatory. Provides input data to the mutation, as an array of CreateLogInput . |
Result
CreateLogBatchResult
type
Attribute |
Type |
Description |
results |
[CreateLogBatch] |
An array of CreateLogBatch objects, where each object contains a log record’s details. |
CreateLogBatch
type
Attribute |
Type |
Description |
item |
Log |
The created log record’s details. |
itemId |
ID |
The id of the created log record. |
error |
Error |
The error object associated with this log record, if any. |
Error
type
Attribute |
Type |
Description |
message |
String |
The text of the error message. |
createSingleDocumentLogs
Logs a batch of events that all pertain to the same document. This mutation is useful when the document, author, event source, event location, and the logged action are the same for all events that are to be logged.
Arguments
Attribute |
Type |
Description |
documentId |
ID! |
Mandatory. The identifier of the document to which the log pertains (for example, an invoice ID). |
documentType |
String! |
Mandatory. The document type as it is defined in your ERP application’s taxonomy. |
dateTime |
DateTime! |
Mandatory. The date and time when the event occurred. |
changes |
[CreateSingleDocumentLogChangeInput]! |
Mandatory. The array of changes to be logged. |
author |
AuthorInput |
Optional. The actual author object associated with this log. |
eventSource |
EventSource |
Optional. This object captures details about the source of the log event. |
eventLocation |
EventLocation |
Optional. This object captures details about the location of the log event. |
action |
String |
Optional. Captures details about the action that took place. |
Attribute |
Type |
Description |
attribute |
AttributeInput |
Optional. The attribute object associated with this log. |
attributeNewValue |
ValueInput |
Optional. The attribute value after the log event. |
attributeOldValue |
ValueInput |
Optional. The attribute value before the log event. |
comment |
String |
Optional. A comment with additional information about the log record. |
custom1 |
String |
Optional. A custom field with additional information about the log record. |
custom2 |
String |
Optional. A custom field with additional information about the log record. |
Result
See the CreateLogBatchResult
type.
updateLog
Updates a log’s comment and custom fields.
Arguments
Attribute |
Type |
Description |
input |
UpdateLogInput! |
Mandatory. Provides input data to the mutation. |
Attribute |
Type |
Description |
id |
ID! |
Mandatory. The ID of the log record to be updated. |
custom1 |
String |
Optional. The new value of the custom1 field. |
custom2 |
String |
Optional. The new value of the custom2 field. |
comment |
String |
Optional. The new value of the comment field. |
Result
See the Log
type.