MicrosoftGraph.Request (Microsoft Graph API Client v0.2.0)
Lower-level API to create and execute Microsoft Graph API requests.
Link to this section Summary
Functions
Create a DELETE request.
Executes a given request.
Create a GET request.
Will make request a paginated request. execute/2
will follow the @odata.nextLink
in the response
if it exists to fetch the next page. Method type will be :get_paginated
.
Create a PATCH request.
Create a POST request.
Create a PUT request.
Puts the advanced query params and headers required for some operations.
Puts a header into the given request.
Link to this section Types
Link to this section Functions
delete(path, options \\ [])
Create a DELETE request.
See new/1
for options.
execute(request, client)
Executes a given request.
example
Example
iex> MicrosoftGraph.Request.execute(%Request{}, %OAuth2.Client{})
{:ok, response}
# Bad request
iex> MicrosoftGraph.Request.execute(%Request{}, %OAuth2.Client{})
{:error, response}
# Unsupported method
iex> MicrosoftGraph.Request.execute(%Request{method: :grab}, %OAuth2.Client{})
{:error, :unsupported_method}
get(path, options \\ [])
Create a GET request.
See new/1
for options.
new(options \\ [])
Create a request. You generally should use the other request constructors like get/2
and post/2
.
Basic request options:
:method
- the request method, defaults to :get.:url
- the request URL.:headers
- the request headers. The headers are automatically encoded using these rules:- atom header names are turned into strings
- string header names are left as is.
:params
- the request params (querystring for get, post body for post,put,patch).:cast
- OData cast, defaults to nothing Options are::user
formicrosoft.graph.user
:group
formicrosoft.graph.group
paginate_results(request)
Will make request a paginated request. execute/2
will follow the @odata.nextLink
in the response
if it exists to fetch the next page. Method type will be :get_paginated
.
patch(path, options \\ [])
Create a PATCH request.
See new/1
for options.
post(path, options \\ [])
Create a POST request.
See new/1
for options.
put(path, options \\ [])
Create a PUT request.
See new/1
for options.
put_advanced_query_params(request)
Puts the advanced query params and headers required for some operations.
https://docs.microsoft.com/en-us/graph/aad-advanced-queries?tabs=http
put_header(request, key, value)
Puts a header into the given request.
example
Example
iex> MicrosoftGraph.Request.put_header(%Request{}, "Content-Type", "application/json")
%Request{}