Skip to content

Commit

Permalink
Merge pull request #67 from Moesif/dg-rename-actions-api
Browse files Browse the repository at this point in the history
Fix: Rename User Action to Custom Action
  • Loading branch information
dgilling authored Oct 28, 2024
2 parents 07e9a30 + 6a2a4e3 commit 4fb601a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion source/includes/_errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Collected events have size limits to ensure performance and stability of the Moe
|Maximum size of a batch of events|50MB|
|Truncation size of request.body or response.body|450KB|

The maximum size of an event (one API call or user action) is 1MB, which is a hard limit due to how the Moesif platform was architected for scale. Majority of APIs we see have an average event size of 1Kb to 5Kb so it would be unusual to reach this limit. With that said, there are a couple of things you can try:
The maximum size of an event (one API call or custom action) is 1MB, which is a hard limit due to how the Moesif platform was architected for scale. Majority of APIs we see have an average event size of 1Kb to 5Kb so it would be unusual to reach this limit. With that said, there are a couple of things you can try:

1. Don't log non API traffic using skip functionality (i.e. HTML, pictures, etc). Moesif is not designed for monitoring access to large files nor provides much usefulness.
2. Remove large keys from payload using mask data. This can be helpful if you have a JSON key that's large but not valuable.
Expand Down
10 changes: 5 additions & 5 deletions source/includes/collector-api/_actions-api.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
## Actions

### Track a User Action
### Track a Custom Action

**`POST https://api.moesif.net/v1/actions`**

Log a single user action to Moesif. An action represents something a customer performed on your website
Log a single custom action to Moesif. An action represents something a customer performed on your website
such as _Sign In_ or _Purchased Subscription_. Each action consists of an _Action Name_ and optional _Metadata_.

<aside class="warning">
Currently only the moesif-browser-js SDK supports tracking actions. If you need to track user actions from your server, use the HTTP API directly.
Currently only the moesif-browser-js SDK supports tracking actions. If you need to track custom actions from your server, use the HTTP API directly.
</aside>

**An example tracking actions using moesif-browser-js:**
Expand Down Expand Up @@ -94,11 +94,11 @@ request |object | __true__ | The object containing the action's request context.
<p style="margin-left:1.5em">ip_address</p> | string| false | IP address of the customer, If not set, we extract the remote IP address.
<p style="margin-left:1.5em">user_agent_string</p> | string | false | The customer's browser agent string for device context.

### Track User Actions in Batch
### Track Custom Actions in Batch

**`POST https://api.moesif.net/v1/actions/batch`**

Log a batch of user action to Moesif. An action represents something a customer performed on your website
Log a batch of custom action to Moesif. An action represents something a customer performed on your website
such as _Sign In_ or _Purchased Subscription_. Each action consists of an _Action Name_ and optional _Metadata_.

This API takes an array form of the same model defined for track single action.
Expand Down
2 changes: 1 addition & 1 deletion source/includes/collector-api/_config-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Replace <i>YOUR_COLLECTOR_APPLICATION_ID</i> with your real Application Id
[
{
"_id": "64ca685a833073c6b41b15f3",
"created_at": "2024-02-01T00:00:00.000",
"created_at": "2024-10-01T00:00:00.000",
"name": "Block Free Users who Exceeded their Monthly Quota",
"block": true,
"type": "user",
Expand Down
24 changes: 12 additions & 12 deletions source/includes/collector-api/_events-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Replace <i>YOUR_COLLECTOR_APPLICATION_ID</i> with your real Application Id
```json
{
"request": {
"time": "2024-02-06T04:45:42.914",
"time": "2024-10-06T04:45:42.914",
"uri": "https://api.acmeinc.com/items/12345/reviews/",
"verb": "POST",
"api_version": "1.1.0",
Expand Down Expand Up @@ -52,7 +52,7 @@ Replace <i>YOUR_COLLECTOR_APPLICATION_ID</i> with your real Application Id
"transfer_encoding": ""
},
"response": {
"time": "2024-02-06T04:45:42.914",
"time": "2024-10-06T04:45:42.914",
"status": 500,
"headers": {
"Vary": "Accept-Encoding",
Expand Down Expand Up @@ -85,7 +85,7 @@ Replace <i>YOUR_COLLECTOR_APPLICATION_ID</i> with your real Application Id
curl -X POST https://api.moesif.net/v1/events \
-H 'Content-Type: application/json' \
-H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID'
-d '{"request":{"time":"2024-02-06T04:45:42.914","uri":"https://api.acmeinc.com/items/12345/reviews/","verb":"POST","api_version":"1.1.0","ip_address":"61.48.220.123","headers":{"Host":"api.acmeinc.com","Accept":"*/*","Connection":"Keep-Alive","Content-Type":"application/json","Content-Length":"126","Accept-Encoding":"gzip"},"body":{"items":[{"direction_type":1,"item_id":"hello","liked":false},{"direction_type":2,"item_id":"world","liked":true}]},"transfer_encoding":""},"response":{"time":"2024-02-06T04:45:42.914","status":500,"headers":{"Vary":"Accept-Encoding","Pragma":"no-cache","Expires":"-1","Content-Type":"application/json; charset=utf-8","Cache-Control":"no-cache"},"body":{"Error":"InvalidArgumentException","Message":"Missing field location"},"transfer_encoding":""},"user_id":"12345","company_id":"67890","transaction_id":"a3765025-46ec-45dd-bc83-b136c8d1d257","metadata":{"some_string":"I am a string","some_int":77,"some_object":{"some_sub_field":"some_value"}}}'
-d '{"request":{"time":"2024-10-06T04:45:42.914","uri":"https://api.acmeinc.com/items/12345/reviews/","verb":"POST","api_version":"1.1.0","ip_address":"61.48.220.123","headers":{"Host":"api.acmeinc.com","Accept":"*/*","Connection":"Keep-Alive","Content-Type":"application/json","Content-Length":"126","Accept-Encoding":"gzip"},"body":{"items":[{"direction_type":1,"item_id":"hello","liked":false},{"direction_type":2,"item_id":"world","liked":true}]},"transfer_encoding":""},"response":{"time":"2024-10-06T04:45:42.914","status":500,"headers":{"Vary":"Accept-Encoding","Pragma":"no-cache","Expires":"-1","Content-Type":"application/json; charset=utf-8","Cache-Control":"no-cache"},"body":{"Error":"InvalidArgumentException","Message":"Missing field location"},"transfer_encoding":""},"user_id":"12345","company_id":"67890","transaction_id":"a3765025-46ec-45dd-bc83-b136c8d1d257","metadata":{"some_string":"I am a string","some_int":77,"some_object":{"some_sub_field":"some_value"}}}'
```

```java
Expand Down Expand Up @@ -376,7 +376,7 @@ rsp_body = JSON.parse('{'\


event_req = EventRequestModel.new()
event_req.time = "2024-02-06T04:45:42.914"
event_req.time = "2024-10-06T04:45:42.914"
event_req.uri = "https://api.acmeinc.com/items/reviews/"
event_req.verb = "PATCH"
event_req.api_version = "1.1.0"
Expand All @@ -385,7 +385,7 @@ event_req.headers = req_headers
event_req.body = req_body

event_rsp = EventResponseModel.new()
event_rsp.time = "2024-02-06T04:45:42.914"
event_rsp.time = "2024-10-06T04:45:42.914"
event_rsp.status = 500
event_rsp.headers = rsp_headers
event_rsp.body = rsp_body
Expand Down Expand Up @@ -451,7 +451,7 @@ var rspBody = APIHelper.JsonDeserialize<object>(@" {

var eventReq = new EventRequestModel()
{
Time = DateTime.Parse("2024-02-06T04:45:42.914"),
Time = DateTime.Parse("2024-10-06T04:45:42.914"),
Uri = "https://api.acmeinc.com/items/reviews/",
Verb = "PATCH",
ApiVersion = "1.1.0",
Expand All @@ -462,7 +462,7 @@ var eventReq = new EventRequestModel()

var eventRsp = new EventResponseModel()
{
Time = DateTime.Parse("2024-02-06T04:45:42.914"),
Time = DateTime.Parse("2024-10-06T04:45:42.914"),
Status = 500,
Headers = rspHeaders,
Body = rspBody
Expand Down Expand Up @@ -689,7 +689,7 @@ Replace <i>YOUR_COLLECTOR_APPLICATION_ID</i> with your real Application Id
[
{
"request": {
"time": "2024-02-06T04:45:42.914",
"time": "2024-10-06T04:45:42.914",
"uri": "https://api.acmeinc.com/items/83738/reviews/",
"verb": "POST",
"api_version": "1.1.0",
Expand Down Expand Up @@ -719,7 +719,7 @@ Replace <i>YOUR_COLLECTOR_APPLICATION_ID</i> with your real Application Id
"transfer_encoding": ""
},
"response": {
"time": "2024-02-06T04:45:42.914",
"time": "2024-10-06T04:45:42.914",
"status": 500,
"headers": {
"Vary": "Accept-Encoding",
Expand Down Expand Up @@ -753,7 +753,7 @@ Replace <i>YOUR_COLLECTOR_APPLICATION_ID</i> with your real Application Id
curl -X POST https://api.moesif.net/v1/events/batch \
-H 'Content-Type: application/json' \
-H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID'
-d '[{"request":{"time":"2024-02-06T04:45:42.914","uri":"https://api.acmeinc.com/items/83738/reviews/","verb":"POST","api_version":"1.1.0","ip_address":"61.48.220.123","headers":{"Host":"api.acmeinc.com","Accept":"*/*","Connection":"Keep-Alive","Content-Type":"application/json","Content-Length":"126","Accept-Encoding":"gzip"},"body":{"items":[{"direction_type":1,"item_id":"hello","liked":false},{"direction_type":2,"item_id":"world","liked":true}]},"transfer_encoding":""},"response":{"time":"2024-02-06T04:45:42.914","status":500,"headers":{"Vary":"Accept-Encoding","Pragma":"no-cache","Expires":"-1","Content-Type":"application/json; charset=utf-8","Cache-Control":"no-cache"},"body":{"Error":"InvalidArgumentException","Message":"Missing field location"},"transfer_encoding":""},"user_id":"12345","company_id":"67890","transaction_id":"a3765025-46ec-45dd-bc83-b136c8d1d257","metadata":{"some_string":"I am a string","some_int":77,"some_object":{"some_sub_field":"some_value"}}}]'
-d '[{"request":{"time":"2024-10-06T04:45:42.914","uri":"https://api.acmeinc.com/items/83738/reviews/","verb":"POST","api_version":"1.1.0","ip_address":"61.48.220.123","headers":{"Host":"api.acmeinc.com","Accept":"*/*","Connection":"Keep-Alive","Content-Type":"application/json","Content-Length":"126","Accept-Encoding":"gzip"},"body":{"items":[{"direction_type":1,"item_id":"hello","liked":false},{"direction_type":2,"item_id":"world","liked":true}]},"transfer_encoding":""},"response":{"time":"2024-10-06T04:45:42.914","status":500,"headers":{"Vary":"Accept-Encoding","Pragma":"no-cache","Expires":"-1","Content-Type":"application/json; charset=utf-8","Cache-Control":"no-cache"},"body":{"Error":"InvalidArgumentException","Message":"Missing field location"},"transfer_encoding":""},"user_id":"12345","company_id":"67890","transaction_id":"a3765025-46ec-45dd-bc83-b136c8d1d257","metadata":{"some_string":"I am a string","some_int":77,"some_object":{"some_sub_field":"some_value"}}}]'
```

```java
Expand Down Expand Up @@ -1073,7 +1073,7 @@ var rspBody = APIHelper.JsonDeserialize<object>(@" {
var reqDate = new Date();
var eventReq = new EventRequestModel()
{
Time = DateTime.Parse("2024-02-06T04:45:42.914"),
Time = DateTime.Parse("2024-10-06T04:45:42.914"),
Uri = "https://api.acmeinc.com/items/reviews/",
Verb = "PATCH",
ApiVersion = "1.1.0",
Expand All @@ -1084,7 +1084,7 @@ var eventReq = new EventRequestModel()

var eventRsp = new EventResponseModel()
{
Time = DateTime.Parse("2024-02-06T04:45:42.914"),
Time = DateTime.Parse("2024-10-06T04:45:42.914"),
Status = 500,
Headers = rspHeaders,
Body = rspBody
Expand Down
10 changes: 5 additions & 5 deletions source/includes/collector-api/_subscriptions-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ and selecting API keys from bottom left menu.
{
"subscription_id": "12345", // Subscription Id
"company_id": "67890", // Company Id
"current_period_start": "2024-02-21T17:32:28.000Z",
"current_period_start": "2024-10-21T17:32:28.000Z",
"current_period_end": "2024-11-21T17:32:28.000Z",
"status": "active",
"metadata": {
Expand All @@ -48,7 +48,7 @@ curl --location 'https://api.moesif.net/v1/subscriptions' \
--data '{
"subscription_id": "12345",
"company_id": "67890",
"current_period_start": "2024-02-21T17:32:28.000Z",
"current_period_start": "2024-10-21T17:32:28.000Z",
"current_period_end": "2024-11-21T17:32:28.000Z",
"status": "active",
"metadata": {
Expand Down Expand Up @@ -101,7 +101,7 @@ Replace <i>my_application_id</i> with your real Application Id
{
"subscription_id": "12345", // Subscription Id
"company_id": "67890", // Company Id
"current_period_start": "2024-02-21T17:32:28.000Z",
"current_period_start": "2024-10-21T17:32:28.000Z",
"current_period_end": "2024-11-21T17:32:28.000Z",
"status": "active",
"metadata": {
Expand All @@ -116,7 +116,7 @@ Replace <i>my_application_id</i> with your real Application Id
{
"subscription_id": "abcde", // Subscription Id
"company_id": "xyz", // Company Id
"current_period_start": "2024-02-21T17:32:28.000Z",
"current_period_start": "2024-10-21T17:32:28.000Z",
"current_period_end": "2024-11-21T17:32:28.000Z",
"status": "active",
"metadata": {
Expand All @@ -139,7 +139,7 @@ curl --location 'https://api.moesif.net/v1/subscriptions/batch' \
--data '[{
"subscription_id": "12345",
"company_id": "67890",
"current_period_start": "2024-02-21T17:32:28.000Z",
"current_period_start": "2024-10-21T17:32:28.000Z",
"current_period_end": "2024-11-21T17:32:28.000Z",
"status": "active",
"metadata": {
Expand Down

0 comments on commit 4fb601a

Please sign in to comment.