API Logger

OnePipe is made up of several microservices performing different distinct operations for a given transaction. In order to harmonise logs for a given transaction across the different microservices, there is need for every API request made by each microservice to other third party systems (or microservices) to be logged on the API Logger - both request details and response details.

 

This document provides details on how to implement the API logger on your microservice.

 

Base URL: https://dwh.bits.[env].onepipe.io

Endpoint: /v2/generic/api-logger/log

--header 'Authorization: Bearer {token}'

**Request for bearer token from your manager

Request Payload

{ "platform": "onepipe", "client": { "client_id": "{{client_id}}", "client_name": "{{client_name}}", "client_app_id": "{{client_app_id}}", "client_app_name": "{{client_app_name}}"" }, "transaction": { "transaction_ref": "{{onepipe_transaction_ref}}", "transaction_timestamp": "2019-09-16T00:55:36.998" }, "request": { "source_name": "{{name_of_microservice}}", "destination_name": "{{destination_name}}", "destination_url": "https://endpoint.com", "request_type": "POST", "request_description": "Process transaction", "request_timestamp": "2019-09-16T00:55:36.998", "request_headers": null, "request_body": { "param_1": "value_1", "param_2": "value_2" } }, "response": { "response_timestamp": "2019-09-16T00:55:36.998", "response_http_status": 200, "response_code": "{{response-http-status-code}}", "response_headers": null, "response_body": { "param_1": "value_1", "param_2": "value_2" } } }

 

Field

Data Type

Description

Example Value

Field

Data Type

Description

Example Value

platform

String

This specifies the platform under which the API Logger is used.

For API Logs used in OnePipe, value of this should be set to onepipe.

onepipe

client_id

String

The id of the OnePipe Client the transaction is being made with.

1f2g34a56578h909ygr4

client_name

String

The name of the OnePipe Client the transaction is being made with.

TrustPay

client_app_id

String

The id of the OnePipe App the transaction is being made with.

90td73js64gd0ja2uf89

client_app_name

String

The name of the OnePipe App the transaction is being made with.

My Business

transaction_ref

String

The actual OnePipe transaction ref of the transaction being performed.

my-transaction-ref-39485

transaction_timestamp

Date String

The time transaction is being processed. Should be in format YYYY-MM-DDTHH:MM:SSS.sss.

2019-09-16T00:55:36.998

source_name

String

Name of the microservice making the http request.

Demo Provider

destination_name

String

Name of the destination http request is being made to.

My Bank

destination_url

String

Endpoint http request is being made to.

https://my-endpoint.com/api/service

request_type

String

Http request type - can be POST , GET , PUT etc

POST

request_description

String

Description or reason for making the request.

Validate User OTP

request_timestamp

Date String

The time http request is being made to the third party system or microservice. Should be in format YYYY-MM-DDTHH:MM:SSS.sss.

2019-09-16T00:55:36.998

request_headers

Json

Possible request headers to log if applicable. Value can be set to null if not applicable.

{ "header_1": "value_1", "header_2": "value_2" }

request_body

Json

Request payload used for the http request.

{ "user_id": "1234567890", "action": "create" }

response_timestamp

Date String

The time http response is being received from the third party system or microservice. Should be in format YYYY-MM-DDTHH:MM:SSS.sss.

2019-09-16T00:55:36.998

response_http_status

Integer

The http response status received.

200

response_code

String

This maps to the key parameter in the response that determines status of the request. Vaue can also be set as the http response status received.

00

response_headers

Json

Possible response headers to log if applicable. Value can be set to null if not applicable.

response_body

Json

Response payload received from the http request.

Response Payload

 

Points to Note

  1. The API Logger request MUST be implemented asynchronously in your code, so as not to increase latency by blocking regular operations that don’t have to wait.

  2. The API Logger can be implemented as a dedicated service implementation that can be invoked immediately after making any http request.

  3. For logs to be successfully harmonised for a given transaction across the several microservices, the client_id , client_app_id and transaction_ref MUST remain consistent while being shipped to the API Logger