Mercadopago.API (MercadopagoAPI v0.1.0)
Documentation for Mercadopago.API. This module is about the base HTTP functionality
Link to this section Summary
Functions
Requests an OAuth token from Mercadopago, returns a tuple containing the token and seconds till expiry.
Make an HTTP DELETE request to the correct API, adding the authentication required header.
Make an HTTP GET request to the correct API, adding the authentication required header.
Make an HTTP POST request to the correct API, adding the authentication required header.
Make an HTTP PUT request to the correct API, adding the authentication required header.
Link to this section Functions
create_token()
Requests an OAuth token from Mercadopago, returns a tuple containing the token and seconds till expiry.
Possible returns:
{:ok, data}
{:error, reason}
examples
Examples
iex> Mercadopago.API.create_token()
{:ok, {..}}
delete(url)
Make an HTTP DELETE request to the correct API, adding the authentication required header.
examples
Examples
iex> Mercadopago.API.delete(url)
{:ok, {...}}
get(url)
Make an HTTP GET request to the correct API, adding the authentication required header.
Possible returns:
{:ok, data}
{:ok, :not_found}
{:ok, :no_content}
{:error, :bad_network}
{:error, reason}
examples
Examples
iex> Mercadopago.API.get(url)
{:ok, {...}}
post(url, data)
@spec post(String.t(), map() | list() | nil) :: {:ok, map() | :not_found | :no_content | nil} | {:error, :unauthorised | :bad_network | any()}
Make an HTTP POST request to the correct API, adding the authentication required header.
examples
Examples
iex> Mercadopago.API.post(url, data)
{:ok, {...}}
put(url, data)
@spec put(String.t(), map() | list() | nil) :: {:ok, map() | :not_found | :no_content | nil} | {:error, :unauthorised | :bad_network | any()}
Make an HTTP PUT request to the correct API, adding the authentication required header.
examples
Examples
iex> Mercadopago.API.put(url, data)
{:ok, {...}}