Request

Request

Requests are how you can interact with 3rd party APIs in your Interweave schema.

const config = {
  requests: {
    get: {
      uri: "https://example.com/genres",
      http_method: "GET",
      data_path: "data.response",
      error_path: "data.error.message",
      headers: {
        "Content-Type": "application/json"
      },
      authentication_key: "api-access"
    }
  }
};

uri

TypeRequiredDefault
stringYesundefined

http_method

"GET" | "POST" | "DELETE" | "PATCH" | "PUT"

TypeRequiredDefault
stringYesundefined

headers

TypeRequiredDefault
objectNoundefined

body

TypeRequiredDefault
objectNoundefined

data_path

Where we want to pull data from in the response from the object. This uses lodash.get method (opens in a new tab).

TypeRequiredDefault
stringNoundefined

error_path

If the request status returns >399, we use this field as the error message. This uses lodash.get method (opens in a new tab).

TypeRequiredDefault
stringNoundefined

default_error

If the request fails and error_path is empty, use this as the message.

TypeRequiredDefault
stringNoundefined

parameters

Fields not specified in the URL will be appended as query parameters. For example, a key of location will be appended as ?location=value

TypeRequiredDefault
FieldsNoundefined

authentication_key

If a Request requires authentication, specify a key from the interface authentication object. If the key is not found in this interfaces' authentication object, it'll look for another the key within another interface within this same project.

TypeRequiredDefault
stringNoundefined

skip_body_attachment

This will prevent the form data from sending with POST, PATCH, and PUT requests.

TypeRequiredDefault
booleanNofalse

value_path

If this is to dynamically fill an enum at run-time, this will be the option's value populated in the Select or MultiSelect component. This find operation will occur on every entry within the returned array.

TypeRequiredDefault
stringNoundefined

label_path

If this is to dynamically fill an enum at run-time, this will be the option's label populated in the Select or MultiSelect component. This find operation will occur on every entry within the returned array.

TypeRequiredDefault
stringNoundefined