Back to top

Audit logs API

This API retrieves backend logs via elastic

Authentication

All apis contain the /v[:version] placeholder. It’s used to do API versioning

  • v0 For testing environments, no authentication is required and it’s disabled on production

  • v1 Production version, authentication required

There are two ways to authenticate the request

  • with just an app_id parameter (if you don’t have an app_id you should request one) (less secure)

  • with an app_id + signature parameters (signature creation explained below) (more secure)

The use of appId or appid is deprecated, use app_id instead

The testing environment is not up 24/7, so some calls to the testing urls may return 404

Create a signature

This method is inspired from https://dev.twitter.com/docs/auth/creating-signature

To sign a request you need:

  • http method in uppercase: GET, POST

  • Request url without parameters

  • The parameter string, a url-encoded and sorted parameters string (see below to know how to generate it)

  • Body bytes content, if you’re not sending form data

  • Current timestamp (in seconds)

  • A nonce, in other words, a random string which have at least 32 characters

  • An app_id provided by R&D

  • A secret (related to the app) provided by R&D

For example, given this parameters as key and values:

{ “query”: “girona”, "period: “last_month”, }

Step 1, add the timestampp, nonce and app_id:

{ “query”: “girona”, “period”: “last_month”, “timestamp”: “1380545928”, “nonce”: “QC3hTWyVby6PtKKeCnxPAEMPXebUP82D”, “app_id”: “3ttp2946sij2hic” }

Step 2, percent encode all keys and values

{ “query”: “girona”, “period”: “last_month”, “timestamp”: “1380545928”, “nonce”: “QC3hTWyVby6PtKKeCnxPAEMPXebUP82D”, “app_id”: “3ttp2946sij2hic” }

Make sure your percent encode library encode spaces as %20 instead of +. Using the + sign will generate an incorrect signature.

Step 3, join the key and value using a = and sort the parameters alphabetically

[ “app_id=3ttp2946sij2hic”, “nonce=QC3hTWyVby6PtKKeCnxPAEMPXebUP82D”, “period=last_month”, “query=girona”, “timestamp=1380545928” ]

Step 4, join all parameters with & to generate the parameter_string

app_id=3ttp2946sij2hic&nonce=QC3hTWyVby6PtKKeCnxPAEMPXebUP82D&period=last_month&query=girona&timestamp=1380545928

Step 5, generate the signature_base string using this schema

signature_base = http_method&url_encoded(request_url)&url_encoded(parameter_string)

Step 6, if you’re sending not form data on body(p.e. a json or plain text), add body bytes after a new line

signature_base = signature_base + “\n” + ‘{“json”: “example”}’

where

  • http_method is the http method used for the request in uppercase: GET

  • request_url is the url without parameters and without the protocol, for example nap.aws.augure.com/v1/search/influencers

  • parameter_string is explained above, for example app_id=3ttp2946sij2hic&nonce=QC3hTWyVby6PtKKeCnxPAEMPXebUP82D&period=last_month&query=girona&timestamp=1380545928

Then the signature_base string will be:

GET&nap.aws.augure.com%2Fv1%2Fsearch%2Finfluencers&app_id%3D3ttp2946sij2hic%26nonce%3DQC3hTWyVby6PtKKeCnxPAEMPXebUP82D%26period%3Dlast_month%26query%3Dgirona%26timestamp%3D1380545928 {“json”: “example”}

don’t forget to url_encode the request_url and the parameter_string

Step 6, generate the signature parameter using the HMAC_SHA1 algorithm. This algorithm needs 2 strings to work, the first one will be the signature_base string, and the second one will be the secret (needed to generate the secure hash).

The output of this algorithm is binary, so you should use base64 encoding to produce the final signature string.

If the secret provided for our app is rpii62atrbqejx27v7uv32qbn8exv7gj then the signature of our request will be

OHQRsFL3dqFIStxxHcv1yY8qcy4=

Step 7, add the signature value to the request parameters and execute the request to the API. In this case will be

{ “query”: “girona”, “period”: “last_month”, “nonce”: “QC3hTWyVby6PtKKeCnxPAEMPXebUP82D”, “timestamp”: “1380545928”, “app_id”: “3ttp2946sij2hic”, “signature”: “OHQRsFL3dqFIStxxHcv1yY8qcy4=” }

Don’t forget, if you’re not using a helper library, you should url encode all keys and values.

For the POST and PUT requests which you’re not sending form data, like a json or plain text, the parameters related to the signature must be added to the url, p.e.: https://nap.launchmetrics.com/v1/analysis?app_id=xxx&nonce=xxx&timestamp=xxx&signature=xxx

Response

All responses return application/json; charset=utf-8.

  • Response ok (application/json)

    The response element will contain the specific API method response.

    {
            "status": "200",
            "time": "0.2",
            "request": {
              "method":"GET",
              "path":"/ping",
              "parameters": {}
          },
          "response": {}
        }
  • Response error (application/json)

    There could be different messages with the correspondent HTTP error code.

    {
            "status": "404",
            "time": "0.2",
            "request": {
              "method":"GET",
              "path":"/ping",
              "parameters": {}
          },
          "error": {
            "code": "WRONG_PARAMETERS",
            "message": "The email parameter is mandatory"
          }
        }

Generic Error codes

  • Http status 400

    • MISSING_PARAMETERS

      Some error with the API parameters

  • Http status 500

    • INTERNAL_ERROR

      Unexpected API error

API Health

There are two default methods available for each API for monitoring purposes.

Ping

Ping
GET/ping

Used to know if the API is up and working

Example URI

GET https://nap.launchmetrics.com/auditLogs/v1/ping
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "pong": "ok"
}

Stats

Stats
GET/stats

It displays information about the API usage and how it performs

Example URI

GET https://nap.launchmetrics.com/auditLogs/v1/stats
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "last24hours": {
    "GET /emailValidation/v1/setEmailStatus": {
      "hour_interval": [
        {
          "hour": "2016-02-18T16:00:00.000Z",
          "count": 2,
          "variance": 0,
          "status": {
            "EMAIL_NOT_FOUND": {
              "count": 2,
              "variance": 0,
              "std_deviation": 0,
              "avg": 0.168862000107765,
              "min": 0.168862000107765,
              "max": 0.168862000107765,
              "sum_of_squares": 0.0570287501607898,
              "std_deviation_bounds": {
                "upper": 0.168862000107765,
                "lower": 0.168862000107765
              },
              "sum": 0.33772400021553
            },
            "OK": {
              "count": 0,
              "variance": null,
              "std_deviation": null,
              "avg": null,
              "min": null,
              "max": null,
              "sum_of_squares": null,
              "std_deviation_bounds": {
                "upper": null,
                "lower": null
              },
              "sum": null
            }
          },
          "min": 0.168862000107765,
          "avg": 0.168862000107765,
          "std_deviation": 0,
          "max": 0.168862000107765,
          "sum_of_squares": 0.0570287501607898,
          "sum": 0.33772400021553,
          "std_deviation_bounds": {
            "upper": 0.168862000107765,
            "lower": 0.168862000107765
          }
        },
        {
          "hour": "2016-02-18T18:00:00.000Z",
          "count": 2,
          "variance": 0,
          "status": {
            "EMAIL_NOT_FOUND": {
              "count": 2,
              "variance": 0,
              "std_deviation": 0,
              "avg": 0.0233999993652105,
              "min": 0.0233999993652105,
              "max": 0.0233999993652105,
              "sum_of_squares": 0.00109511994058371,
              "std_deviation_bounds": {
                "upper": 0.0233999993652105,
                "lower": 0.0233999993652105
              },
              "sum": 0.0467999987304211
            },
            "OK": {
              "count": 0,
              "variance": null,
              "std_deviation": null,
              "avg": null,
              "min": null,
              "max": null,
              "sum_of_squares": null,
              "std_deviation_bounds": {
                "upper": null,
                "lower": null
              },
              "sum": null
            }
          },
          "min": 0.0233999993652105,
          "avg": 0.0233999993652105,
          "std_deviation": 0,
          "max": 0.0233999993652105,
          "sum_of_squares": 0.00109511994058371,
          "sum": 0.0467999987304211,
          "std_deviation_bounds": {
            "upper": 0.0233999993652105,
            "lower": 0.0233999993652105
          }
        },
        {
          "hour": "2016-02-18T20:00:00.000Z",
          "count": 2,
          "variance": 0,
          "status": {
            "EMAIL_NOT_FOUND": {
              "count": 2,
              "variance": 0,
              "std_deviation": 0,
              "avg": 0.0268389992415905,
              "min": 0.0268389992415905,
              "max": 0.0268389992415905,
              "sum_of_squares": 0.00144066376058019,
              "std_deviation_bounds": {
                "upper": 0.0268389992415905,
                "lower": 0.0268389992415905
              },
              "sum": 0.053677998483181
            },
            "OK": {
              "count": 0,
              "variance": null,
              "std_deviation": null,
              "avg": null,
              "min": null,
              "max": null,
              "sum_of_squares": null,
              "std_deviation_bounds": {
                "upper": null,
                "lower": null
              },
              "sum": null
            }
          },
          "min": 0.0268389992415905,
          "avg": 0.0268389992415905,
          "std_deviation": 0,
          "max": 0.0268389992415905,
          "sum_of_squares": 0.00144066376058019,
          "sum": 0.053677998483181,
          "std_deviation_bounds": {
            "upper": 0.0268389992415905,
            "lower": 0.0268389992415905
          }
        }
      ],
      "count": 2068,
      "variance": 0.952526547318981,
      "min": 18.1012001037598,
      "avg": 19.8605297686284,
      "std_deviation": 0.975974665305909,
      "max": 23.6008319854736,
      "sum_of_squares": 817673.073983961,
      "std_deviation_bounds": {
        "upper": 21.8124790992402,
        "lower": 17.9085804380165
      },
      "sum": 41071.5755615234
    }
  },
  "last15days": {
    "GET /emailValidation/v1/setServerEmailsVerificationPending": {
      "count": 1,
      "variance": 0,
      "min": 28.7900829315186,
      "avg": 28.7900829315186,
      "std_deviation": 0,
      "max": 28.7900829315186,
      "sum_of_squares": 828.868875203716,
      "day_interval": [
        {
          "count": 1,
          "variance": 0,
          "status": {
            "CONNECTION_ERROR": {
              "count": 1,
              "variance": 0,
              "std_deviation": 0,
              "avg": 28.7900829315186,
              "min": 28.7900829315186,
              "max": 28.7900829315186,
              "sum_of_squares": 828.868875203716,
              "std_deviation_bounds": {
                "upper": 28.7900829315186,
                "lower": 28.7900829315186
              },
              "sum": 28.7900829315186
            },
            "OK": {
              "count": 0,
              "variance": null,
              "std_deviation": null,
              "avg": null,
              "min": null,
              "max": null,
              "sum_of_squares": null,
              "std_deviation_bounds": {
                "upper": null,
                "lower": null
              },
              "sum": null
            }
          },
          "min": 28.7900829315186,
          "avg": 28.7900829315186,
          "std_deviation": 0,
          "max": 28.7900829315186,
          "sum_of_squares": 828.868875203716,
          "day": "2016-02-07T00:00:00.000Z",
          "sum": 28.7900829315186,
          "std_deviation_bounds": {
            "upper": 28.7900829315186,
            "lower": 28.7900829315186
          }
        }
      ],
      "std_deviation_bounds": {
        "upper": 28.7900829315186,
        "lower": 28.7900829315186
      },
      "sum": 28.7900829315186
    }
  }
}

auditlogs

auditlogs
GET/auditlogs/{team}{group}{id}{?type}{?limit}{?sort}

Retrieve logs

Example URI

GET https://nap.launchmetrics.com/auditLogs/v1/auditlogs/BITvoices17841401728660308?type=instagramProfile?limit=235?sort=actor.name:asc
URI Parameters
HideShow
team
string (required) Example: BIT

Which team is has the logs requested

group
string (required) Example: voices

Which type of information has been requested

id
string (required) Example: 17841401728660308

Id of the element searched

type
string (optional) Example: instagramProfile

Type of the element searched

limit
string (optional) Default: 500 Example: 235

Maximum number of data to be returned

sort
string (optional) Default: date:desc Example: actor.name:asc

Order of the returned data

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "response": {
    "hits": {
      "hits": [
        {
          "_source": {
            "additional_information": null,
            "date": "2020-03-12T13:40:04.482Z",
            "message": "Historical Recovery finished - Period: 2020-02-01 - 2020-03-12 - Retrieved 161 posts, inserted 157 posts",
            "actor": {
              "name": "instagramHistoricalRecovery",
              "type": "bot",
              "id": null
            },
            "group": "voices",
            "entity": {
              "name": "instagramProfile",
              "id": "17841401728660308"
            },
            "action": "update",
            "team": "BIT"
          },
          "sort": [
            "1584020404482"
          ],
          "_score": null,
          "_index": "bit_logs_voices",
          "_id": "jLv5znABMl0QQX9BVLso",
          "_type": "_doc"
        }
      ],
      "max_score": null,
      "total": 1
    },
    "timed_out": false,
    "_shards": {
      "failed": 0,
      "successful": 1,
      "total": 1,
      "skipped": 0
    },
    "took": 0
  }
}

Generated by aglio on 24 Aug 2026