Skip to Content

API Manager Log Service API (Beta)

Introduction

As an alternative to downloading an API log file by clicking Download as CSV on the API Logs page, you can retrieve an API log file using a REST API. This requires the use of either command line utilities such as curl or applications such as Postman.

To use the API Manager Log Service API (Beta), after enabling API logs for the API Manager API, follow these steps:

  1. Retrieve an authentication token using the User Service Controller API. This token is required in order to use the API Manager Log Service API (Beta).

  2. Retrieve the log file using the API Manager Log Service API (Beta).

Retrieve an authentication token

Retrieving an authentication token requires the use of the User Service Controller API.

Important

If your Harmony organization has TFA enabled, this request will fail. Retrieving the authentication token requires two different requests.

An example request showing logging in to the NA region and retrieving the authorization token:

Using curl
curl --location --request PUT 'https://na-east.jitterbit.com/jitterbit-cloud-restful-service/user/login' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "alice@jbexample.com",
    "password": "Jitterbit4Ever!"
}'

Base URL

The base URL depends on the region that the organization is located in:

Region Base URL
NA https://na-east.jitterbit.com/jitterbit-cloud-restful-service/user/login
EMEA https://emea-west.jitterbit.com/jitterbit-cloud-restful-service/user/login
APAC https://apac.jitterbit.com/jitterbit-cloud-restful-service/user/login

Headers

These headers are required:

Header Required Example Description
Content-Type Required 'Content-Type: application/json' Indicates the format that will be sent in the request.

Body parameters

These required parameters are passed in the body of the request:

Required Parameter Required Type Example Description
email Required String alice@jbexample.com Harmony username (email address) with a role with Admin permission in the organization
password Required String Jitterbit4Ever! Harmony user password

Response body

The returned response body contains a list of the organizations that the user is associated with in addition to the authentication token ("authenticationToken"). This token is required for subsequent authorization with the API Manager Log Service API (Beta). In this example, the authentication token is "1_70dfe7f7-1d47-4ad5-be5d-bc4a222dd2g4". The organization ID is shown as "123456" for the first organization that this user belongs to. An example of the response:

Response Body
{
  "status": true,
  "operation": "User login",
  "authenticationToken": "1_70dfe7f7-1d47-4ad5-be5d-bc4a222dd2g4",
  "serverUrl": "https://na-east.jitterbit.com",
  "cloudAppsUrl": "https://na-east.jitterbit.com",
  "orgAttrs": [
    {
      "orgId": "123456",
      "orgName": "JB Example Company",
      "orgZoneUrl": "https://na-east.jitterbit.com"
    },
    {
      "orgId": "20970",
      "orgName": "example@jbexample.com",
      "orgZoneUrl": "https://na-east.jitterbit.com"
    }
  ],
  "defaultOrgId": "123456",
  "sessionTimeoutInSeconds": 14400
}

Retrieve an authentication token with TFA enabled

If a user's Harmony organization has two-factor authentication (TFA) enabled, retrieving the authentication token requires two requests using the User Service Controller API:

  1. Retrieve a TFA code

  2. Use the TFA code to retrieve an authentication token

Retrieve a TFA code

A valid TFA code is required to retrieve an authentication token when TFA is enabled. An example request showing logging in to the NA region and requesting a TFA code:

Using curl
curl --location --request PUT 'https://na-east.jitterbit.com/jitterbit-cloud-restful-service/user/login' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "alice@jbexample.com",
    "password": "Jitterbit4Ever!",
    "deviceId": "abcd"
}'
Base URL

The base URL depends on the region that the organization is located in:

Region Base URL
NA https://na-east.jitterbit.com/jitterbit-cloud-restful-service/user/login
EMEA https://emea-west.jitterbit.com/jitterbit-cloud-restful-service/user/login
APAC https://apac.jitterbit.com/jitterbit-cloud-restful-service/user/login
Headers

These headers are required:

Header Required Example Description
Content-Type Required 'Content-Type: application/json' Indicates the format that will be sent in the request.
Body parameters

These required parameters are passed in the body of the request:

Required Parameter Required Type Example Description
email Required String alice@jbexample.com Harmony username (email address) with a role with Admin permission in the organization
password Required String Jitterbit4Ever! Harmony user password
deviceId Required String abcd Identifier that will be used to confirm the TFA code in the next request
Response body

The returned response body contains an error message indicating that a TFA code was sent to the user's email address.

Response Body
{
  "status": false,
  "operation": "User login",
  "errorCode": "VALIDATE_TFA_LOGIN_EMAIL",
  "errorMessage": "Validate your login with authentication code. An email from Jitterbit with the code was sent to you.",
  "authenticationToken": null,
  "serverUrl": "https://na-east.jitterbit.com",
  "orgAttrs": [],
  "defaultOrgId": null
}

Use the TFA code to retrieve an authentication token

The TFA code sent to the user's email address can now be used in the second request to retrieve the authentication token. An example request showing logging in to the NA region with a TFA code and retrieving the authorization token:

Using curl
curl --location --request PUT 'https://na-east.jitterbit.com/jitterbit-cloud-restful-service/user/login/tfacode' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "alice@jbexample.com",
    "password": "Jitterbit4Ever!",
    "code": "112233",
    "deviceId": "abcd"
}'
Base URL

The base URL depends on the region that the organization is located in:

Region Base URL
NA https://na-east.jitterbit.com/jitterbit-cloud-restful-service/user/login/tfacode
EMEA https://emea-west.jitterbit.com/jitterbit-cloud-restful-service/user/login/tfacode
APAC https://apac.jitterbit.com/jitterbit-cloud-restful-service/user/login/tfacode
Headers

These headers are required:

Header Required Example Description
Content-Type Required 'Content-Type: application/json' Indicates the format that will be sent in the request.
Body parameters

These required parameters are passed in the body of the request:

Required Parameter Required Type Example Description
email Required String alice@jbexample.com Harmony username (email address) with a role with Admin permission in the organization
password Required String Jitterbit4Ever! Harmony user password
code Required String 112233 TFA code sent to the Harmony user's email
deviceId Required String abcd Identifier submitted to generate the TFA code in the previous request
Response body

The returned response body contains a list of the organizations that the user is associated with in addition to the authentication token ("authenticationToken"). This token is required for subsequent authorization with the API Manager Log Service API (Beta). In this example, the authentication token is "1_70dfe7f7-1d47-4ad5-be5d-bc4a222dd2g4". The organization ID is shown as "123456" for the first organization that this user belongs to. An example of the response:

Response Body
{
  "status": true,
  "operation": "User login",
  "authenticationToken": "1_70dfe7f7-1d47-4ad5-be5d-bc4a222dd2g4",
  "serverUrl": "https://na-east.jitterbit.com",
  "cloudAppsUrl": "https://na-east.jitterbit.com",
  "orgAttrs": [
    {
      "orgId": "123456",
      "orgName": "JB Example Company",
      "orgZoneUrl": "https://na-east.jitterbit.com"
    },
    {
      "orgId": "654321",
      "orgName": "example@jbexample.com",
      "orgZoneUrl": "https://na-east.jitterbit.com"
    }
  ],
  "defaultOrgId": "123456",
  "sessionTimeoutInSeconds": 14400
}

Retrieve API logs asynchronously (Beta)

Once you have the authentication token and the organization ID, you can retrieve API logs asynchronously using the API Manager Log Service API (Beta). An example showing retrieving all records from January 20, 2023 to January 20, 2024:

Using curl
curl --location --request PUT 'https://na-east.jitterbit.com/jitterbit-cloud-restful-service/api/analytics/debuglogs-async' \
--header 'Content-Type: application/json' --header 'Accept: application/json' --header 'authToken: 1_70dfe7f7-1d47-4ad5-be5d-bc4a222dd2g4' \
--data-raw '{
    "ascendSort": false,
    "retrieveLogMessages": false,
    "timeRangeFrom": "01/20/2023 01:01:00 +0100",
    "timeRangeTo": "01/20/2024 01:01:00 +0100",
    "clientTimeZone": "Europe/Berlin",
    "queryString": "responsetime>5; sourceip=14.141%",
    "orgId": "123456",
    "csvFormat": true
}'

Base URL

The base URL depends on the region that the organization is located in:

Region Base URL
NA https://na-east.jitterbit.com/jitterbit-cloud-restful-service/api/analytics/debuglogs-async
EMEA https://emea-west.jitterbit.com/jitterbit-cloud-restful-service/api/analytics/debuglogs-async
APAC https://apac.jitterbit.com/jitterbit-cloud-restful-service/api/analytics/debuglogs-async

Headers

These headers can be used in the request:

Header Required Example Description
Content-Type Required 'Content-Type: application/json' Indicates the format that will be sent in the request.
Accept Required 'Accept: application/json' Indicates the format that will be accepted in the response.
authToken Required 'authToken: 1_70dfe7f7-1d47-4ad5-be5d-bc4a222dd2g4' Passes the authorization token (authenticationToken) returned by the User Service Controller API.

Body parameters

These parameters can be passed in the body of the request:

Key Required Type Example Description
ascendSort Optional Boolean false The sort order of the log entries, one of true or false. By default, this value is false.
retrieveLogMessages Optional String false The visibility of messages in the retrieved log entries, one of true or false. By default, this value is false.
timeRangeFrom Required String 01/20/2023 01:01:00 +0100 The start date and time for filtering log entries in a time range.
timeRangeTo Required String 01/20/2024 01:01:00 +0100 The end date and time for filtering log entries in a time range.
clientTimeZone Optional String Europe/Berlin The time zone identifier to resolve times to. For a list of valid identifiers, see the list of tz database time zones. By default, this value is UTC.
queryString Optional String responsetime>5; sourceip=14.141% The query string for filtering log entries based on the provided condition. Conditions can be a list of comparisons between column values and known values, each delimited by a semicolon (;). Valid column names include time, apiname, envname, authprofile, requestid, requestmethod, requesturi, responsetime, sourceip, sourceapp, statuscode, and message. Valid comparison operators include =, <>, !=, >, <, >=, and <=.
orgId Required String 123456 Your Harmony organization ID. The organization must be located in the region that matches the base URL.
csvFormat Optional Boolean true The format of the output, one of true for CSV or false for JSON. By default, this value is true.

Response body

If successful, the returned response body contains a reference key for tracking and downloading the API log file based on the supplied parameters:

Response Body
{
    "key": "debug-log-E8D47FE1F172D3EE46C620791E614B78D111CE624485D2E1B3D482370690DC40",
    "status": "COMPLETE"
}

The reference key can then be supplied as part of the following API call to check on the log file's status or to download it if the status is COMPLETE:

Using curl
curl --location --request GET 'https://na-east.jitterbit.com/jitterbit-cloud-restful-service/api/analytics/log-async/{orgId}/{key}' \
--header 'Content-Type: application/json' --header 'Accept: application/json' --header 'authToken: 1_70dfe7f7-1d47-4ad5-be5d-bc4a222dd2g4'

Possible statuses include:

  • RECEIVED: Harmony received a valid request to generate the log file. The status will transition to PROCESSING when the request is being executed.
  • PROCESSING: The log file is being generated. The status will transition to COMPLETE when the file generation is complete.
  • COMPLETE: The log file is ready to be downloaded using the log-async API above.
  • INVALID: The reference key could not be found. This status is only reported if an unknown or malformed reference key is supplied to the log-async API.
  • ERROR: The reference key was found after the API finished trying to generate the log file, but an error was reported. An error message will also be returned detailing why the generation failed.
  • NO_DATA: The filtering parameters querying data in the original API call returned 0 results.

Important

The generated file will be saved for 24 hours. The reference key will be saved for 23 hours. The same exact request will not generate more files during this period of time unless the request returned an ERROR or NO_DATA status.

Caution

In the event an error occurs during the RECEIVED or PROCESSING statuses, the request will be locked until the reference key expires. Changing any parameter of a request will make it distinct, allowing for workaround requests if this issue is encountered.