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 +155,23 @@ options.getApiVersion = function (event, context) {
150
155
}
151
156
```
152
157
158
+
#### __`getMetadata`__
159
+
160
+
Type: `(event, context) => String`
161
+
getMetadata is a function that AWS lambda `event` and `context` objects as arguments and returns an object that allows you
162
+
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
266
see below or the [Moesif Node API Documentation](https://www.moesif.com/docs/api?javascript).
244
267
245
-
Fields | Required | Description
268
+
Name | Required | Description
246
269
--------- | -------- | -----------
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
270
+
request | __true__ | The object that specifies the request message
271
+
request.time| __true__ | Timestamp for the request in ISO 8601 format
272
+
request.uri| __true__ | Full uri such as _https://api.com/?query=string_ including host, query string, etc
273
+
request.verb| __true__ | HTTP method used, i.e. `GET`, `POST`
274
+
request.api_version| false | API Version you want to tag this request with such as _1.0.0_
275
+
request.ip_address| false | IP address of the requester, If not set, we use the IP address of your logging API calls.
276
+
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)
277
+
request.body| false | Body of the request in JSON format or Base64 encoded binary data (see _transfer_encoding_)
278
+
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
279
||
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
280
+
response | false | The object that specifies the response message, not set implies no response received such as a timeout.
281
+
response.time| __true__ | Timestamp for the response in ISO 8601 format
282
+
response.status| __true__ | HTTP status code as number such as _200_ or _500_
283
+
response.ip_address| false | IP address of the responding server
284
+
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)
285
+
response.body| false | Body of the response in JSON format or Base64 encoded binary data (see _transfer_encoding_)
286
+
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
287
+
||
288
+
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.
289
+
user_id | _Recommend_ | Identifies this API call to a permanent user_id
290
+
metadata | false | A JSON Object consisting of any custom metadata to be stored with this event.
260
291
261
292
262
293
### updateUser method
263
294
264
-
A method is attached to the moesif middleware object to update the users profile or metadata.
295
+
A method is attached to the Moesif middleware object to update the user's profile or metadata.
0 commit comments