You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -150,6 +154,23 @@ options.getApiVersion = function (event, context) {
150
154
}
151
155
```
152
156
157
+
#### __`getMetadata`__
158
+
159
+
Type: `(event, context) => String`
160
+
getMetadata is a function that AWS lambda `event` and `context` objects as arguments and returns an object that allows you
161
+
to add custom metadata that will be associated with the req. The metadata must be a simple javascript object that can be converted to JSON. For example, you may want to save a VM instance_id, a trace_id, or a tenant_id with the request.
For more documentation regarding what fields and meaning,
243
265
see below or the [Moesif Node API Documentation](https://www.moesif.com/docs/api?javascript).
244
266
245
-
Fields | Required | Description
267
+
Name | Required | Description
246
268
--------- | -------- | -----------
247
-
request.time | Required | Timestamp for the request in ISO 8601 format
248
-
request.uri | Required | Full uri such as https://api.com/?query=string including host, query string, etc
249
-
request.verb | Required | HTTP method used, i.e. `GET`, `POST`
250
-
request.api_version | Optional | API Version you want to tag this request with
251
-
request.ip_address | Optional | IP address of the end user
252
-
request.headers | Required | Headers of the request
253
-
request.body | Optional | Body of the request in JSON format
269
+
request | __true__ | The object that specifies the request message
270
+
request.time| __true__ | Timestamp for the request in ISO 8601 format
271
+
request.uri| __true__ | Full uri such as _https://api.com/?query=string_ including host, query string, etc
272
+
request.verb| __true__ | HTTP method used, i.e. `GET`, `POST`
273
+
request.api_version| false | API Version you want to tag this request with such as _1.0.0_
274
+
request.ip_address| false | IP address of the requester, If not set, we use the IP address of your logging API calls.
275
+
request.headers| __true__ | Headers of the request as a `Map<string, string>`. Multiple headers with the same key name should be combined together such that the values are joined by a comma. [HTTP Header Protocol on w3.org](https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2)
276
+
request.body| false | Body of the request in JSON format or Base64 encoded binary data (see _transfer_encoding_)
277
+
request.transfer_encoding| false | A string that specifies the transfer encoding of Body being sent to Moesif. If field nonexistent, body assumed to be JSON or text. Only possible value is _base64_ for sending binary data like protobuf
254
278
||
255
-
response.time | Required | Timestamp for the response in ISO 8601 format
256
-
response.status | Required | HTTP status code such as 200 or 500
257
-
request.ip_address | Optional | IP address of the responding server
258
-
response.headers | Required | Headers of the response
259
-
response.body | Required | Body of the response in JSON format
279
+
response | false | The object that specifies the response message, not set implies no response received such as a timeout.
280
+
response.time| __true__ | Timestamp for the response in ISO 8601 format
281
+
response.status| __true__ | HTTP status code as number such as _200_ or _500_
282
+
response.ip_address| false | IP address of the responding server
283
+
response.headers| __true__ | Headers of the response as a `Map<string, string>`. Multiple headers with the same key name should be combined together such that the values are joined by a comma. [HTTP Header Protocol on w3.org](https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2)
284
+
response.body| false | Body of the response in JSON format or Base64 encoded binary data (see _transfer_encoding_)
285
+
response.transfer_encoding| false | A string that specifies the transfer encoding of Body being sent to Moesif. If field nonexistent, body assumed to be JSON or text. Only possible value is _base64_ for sending binary data like protobuf
286
+
||
287
+
session_token | _Recommend_ | The end user session token such as a JWT or API key, which may or may not be temporary. Moesif will auto-detect the session token automatically if not set.
288
+
user_id | _Recommend_ | Identifies this API call to a permanent user_id
289
+
metadata | false | A JSON Object consisting of any custom metadata to be stored with this event.
260
290
261
291
262
292
### updateUser method
263
293
264
-
A method is attached to the moesif middleware object to update the users profile or metadata.
294
+
A method is attached to the Moesif middleware object to update the user's profile or metadata.
0 commit comments