Help Needed with Analytics Endpoint (/v1/analytics/activities)

Hi everyone,

I’m having some trouble working with the analytics endpoint on the Amity API. I’m following what’s in the docs (Amity API), but I’m not sure if I’m constructing my request correctly.

Here’s the curl command I’m using, to help with the debugging…

curl -X POST 'https://apix.us.amity.co/api/v1/analytics/activities' \
  -H 'Accept: */*' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <bearer_token>' \
  -d '{"activities": [{"contentId": "67227475cb3de54ce13a0e9f", "contentType": "post", "activityType": "impression", "timestamp": {}}]}'

My main questions are:

  1. Timestamp Format:
    The request currently sends an empty object for "timestamp": {}. Is this the correct format? Should I pass an actual timestamp (e.g., as a Unix epoch number or an ISO8601 string) instead of an empty object? What timestamp should I pass, given the fact that I already identify the post through it’s ID?
  2. Additional Parameters or Headers:
    Are there any additional parameters or headers required by this endpoint that I might be missing?

Any guidance or pointers to documentation would be greatly appreciated!

Hi @thiagobellotto-ss , activityType should be “view” and timestamp can be string of a timestamp. Here is example of my curl

curl -X POST 'https://apix.sg.amity.co/api/v1/analytics/activities' \
  -H 'Accept: */*' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <token> \
  -d '{
    "activities": [
      {
        "contentId": "67a0fbf893378e51ad107c17",
        "contentType": "post",
        "activityType": "view",
        "timestamp": "2024-02-03T12:34:56Z"
      }
    ]
  }'
2 Likes

Thanks! That worked. Although… All I got was…

{‘success’: True}

I was expecting to actually visualize some data back…

Hello @thiagobellotto-ss , After checking with our team, we confirmed that this API is designed primarily for writing data, with the main purpose of increasing the impression count. It does not support data retrieval or visualization.