diff --git a/source/includes/collector-api/_events-api.md b/source/includes/collector-api/_events-api.md
index 6edcf73..342b90a 100644
--- a/source/includes/collector-api/_events-api.md
+++ b/source/includes/collector-api/_events-api.md
@@ -22,7 +22,7 @@ Replace YOUR_COLLECTOR_APPLICATION_ID with your real Application Id
```json
{
"request": {
- "time": "2024-10-06T04:45:42.914",
+ "time": "2024-10-30T04:45:42.914",
"uri": "https://api.acmeinc.com/items/12345/reviews/",
"verb": "POST",
"api_version": "1.1.0",
@@ -52,7 +52,7 @@ Replace YOUR_COLLECTOR_APPLICATION_ID with your real Application Id
"transfer_encoding": ""
},
"response": {
- "time": "2024-10-06T04:45:42.914",
+ "time": "2024-10-30T04:45:42.914",
"status": 500,
"headers": {
"Vary": "Accept-Encoding",
@@ -85,49 +85,35 @@ Replace YOUR_COLLECTOR_APPLICATION_ID 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-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"}}}'
+ -d '{"request":{"time":"2024-10-30T04: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-30T04: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
-// Import the Library
-MoesifAPIClient client = new MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID");
-APIController api = getClient().getAPI();
+String reqBody = "{" +
+ "\"items\": [" +
+ "{" +
+ "\"type\": 1," +
+ "\"id\": \"hello\"" +,
+ "}" +
+ "]" +
+ "}";
+
+String rspBody = "{" +
+ "\"Error\": \"InvalidArgumentException\"," +
+ "\"Message\": \"Missing field field_a\"" +
+ "}";
// Generate the event
Map reqHeaders = new HashMap();
reqHeaders.put("Host", "api.acmeinc.com");
-reqHeaders.put("Accept", "*/*");
-reqHeaders.put("Connection", "Keep-Alive");
-reqHeaders.put("User-Agent", "Apache-HttpClient");
reqHeaders.put("Content-Type", "application/json");
-reqHeaders.put("Content-Length", "126");
reqHeaders.put("Accept-Encoding", "gzip");
-Object reqBody = APIHelper.deserialize("{" +
- "\"items\": [" +
- "{" +
- "\"type\": 1," +
- "\"id\": \"hello\"" +,
- "}," +
- "{" +
- "\"type\": 2," +
- "\"id\": \"world\"" +
- "}" +
- "]" +
- "}");
-
Map rspHeaders = new HashMap();
-rspHeaders.put("Vary", "Accept-Encoding");
-rspHeaders.put("Pragma", "no-cache");
-rspHeaders.put("Expires", "-1");
rspHeaders.put("Content-Type", "application/json; charset=utf-8");
-rspHeaders.put("Cache-Control","no-cache");
-
-Object rspBody = APIHelper.deserialize("{" +
- "\"Error\": \"InvalidArgumentException\"," +
- "\"Message\": \"Missing field field_a\"" +
- "}");
+BodyParser.BodyWrapper reqBodyWrapper = BodyParser.parseBody(reqHeaders, reqBody);
+BodyParser.BodyWrapper rspBodyWrapper = BodyParser.parseBody(rspHeaders, rspBody);
EventRequestModel eventReq = new EventRequestBuilder()
.time(new Date())
@@ -136,15 +122,16 @@ EventRequestModel eventReq = new EventRequestBuilder()
.apiVersion("1.1.0")
.ipAddress("61.48.220.123")
.headers(reqHeaders)
- .body(reqBody)
+ .body(reqBodyWrapper.body)
+ .transferEncoding(reqBodyWrapper.transferEncoding);
.build();
-
EventResponseModel eventRsp = new EventResponseBuilder()
.time(new Date(System.currentTimeMillis() + 1000))
.status(500)
.headers(rspHeaders)
- .body(rspBody)
+ .body(rspBodyWrapper.body)
+ .transferEncoding(rspBodyWrapper.transferEncoding);
.build();
EventModel eventModel = new EventBuilder()
@@ -160,18 +147,19 @@ APIController api = getClient().getAPI();
APICallBack