Request Interface
The Request interface contains information on a HTTP request related to the event. In client SDKs, this can be an outgoing request, or the request that rendered the current web page. On server SDKs, this could be the incoming web request that is being handled.
The data variable should only contain the request body (not the query string). It can either be a dictionary (for standard HTTP requests) or a raw request body.
In the Request interface, several attributes can either be declared as string, object, or list of tuples. Sentry attempts to parse structured information from the string representation in such cases.
Sometimes, keys can be declared multiple times, or the order of elements matters. In such cases, use the tuple representation over a plain object.
Example of request headers as object:
{
"content-type": "application/json",
"accept": "application/json, application/xml"
}
Example of the same headers as list of tuples:
[
["content-type", "application/json"],
["accept", "application/json"],
["accept", "application/xml"]
]
method
- Optional. The HTTP method of the request.
url
- Optional. The URL of the request if available. The query string can bedeclared either as part of the
url
, or separately inquery_string
. query_string
- Optional. The query string component of the URL. Can be given as unparsedstring, dictionary, or list of tuples.
If the query string is not declared and part of the url
parameter, Sentry moves it to the query string.
data
- Optional. Submitted data in a format that makes the most sense. SDKs shoulddiscard large bodies by default. Can be given as string or structural data ofany format.
Always trim and truncate the request data before attaching it to the event. If this is not possible, place a description into API documentation that users should truncate request data. While Sentry will try to trim this field upon ingestion, large bodies may cause the entire event payload to exceed its maximum size limit, in which case the event is dropped.
cookies
- Optional. The cookie values. Can be given unparsed as string, as dictionary,or as a list of tuples.
headers
- Optional. A dictionary of submitted headers. If a header appears multipletimes it, needs to be merged according to the HTTP standard for headermerging. Header names are treated case-insensitively by Sentry.
env
- Optional. A dictionary containing environment information passed from theserver. This is where information such as CGI/WSGI/Rack keys go that are notHTTP headers.
Sentry will explicitly look for REMOTE_ADDR
to extract an IP address.
A fully populated request interface:
{
"request": {
"method": "POST",
"url": "http://absolute.uri/foo",
"query_string": "query=foobar&page=2",
"data": {
"foo": "bar"
},
"cookies": "PHPSESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;",
"headers": {
"content-type": "text/html"
},
"env": {
"REMOTE_ADDR": "192.168.0.1"
}
}
}
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").