redivis.make_api_request
Last updated
Was this helpful?
Last updated
Was this helpful?
Initiates an authenticated HTTP request to the .
If parse_response=True
(the default) the result will be a dict
corresponding to the API endpoint's JSON response, or None
if the response is empty. Otherwise, returns a object.
In most cases, you should use the various other methods in the redivis python library, rather than interfacing with the API directly, as these methods are far more user-friendly and cover the vast majority of the REST API.
However, in certain advanced cases, it may make sense to call API endpoint directly through this method.
method
: str {"GET" | "POST" | "PATCH" | "PUT" | "HEAD" | "DELETE" }, default "GET"
The HTTP method of the request. Defaults to "GET"
path
: str, default ""
The API path, including the leading forward slash. E.g.: "/organizations/demo/datasets"
query
: dict
An optional dictionary of query parameters to add to the path
payload
: dict | any
An optional payload to include with the request. If provided and parse_payload=True
, must be a dictionary that will be converted to a JSON string. If parse_payload=False
, the contents will be sent up as the raw request body.
parse_response
: bool, default True
Whether to parse the API response into a dict. Typically should be set to True, unless the API endpoint doesn't return JSON.
parse_payload
: bool, default True
Whether to convert the provided dictionary payload into a JSON string to send to the API. Most endpoints that accept a payload in the body expect a JSON payload.
headers
: dict
An optional dictionary of additional headers to include in the request. Note that authentication is already handled, an there is no need to provide API credentials in the headers when using this method.
stream
: bool, default False
For advanced use cases. If True, the response will be read as a stream; in this scenario, parse_response
must be set to False.
Dict | None |