Skip to content

Latest commit

 

History

History
123 lines (87 loc) · 3.57 KB

request.mdx

File metadata and controls

123 lines (87 loc) · 3.57 KB

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

Type Required Default
string Yes undefined

http_method

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

Type Required Default
string Yes undefined

headers

Type Required Default
object No undefined

body

Type Required Default
object No undefined

data_path

Where we want to pull data from in the response from the object. This uses lodash.get method.

Type Required Default
string No undefined

error_path

If the request status returns >399, we use this field as the error message. This uses lodash.get method.

Type Required Default
string No undefined

default_error

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

Type Required Default
string No undefined

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

Type Required Default
Fields No undefined

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.

Type Required Default
string No undefined

skip_body_attachment

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

Type Required Default
boolean No false

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.

Type Required Default
string No undefined

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.

Type Required Default
string No undefined