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"
}
}
};
Type |
Required |
Default |
string |
Yes |
undefined |
"GET" | "POST" | "DELETE" | "PATCH" | "PUT"
Type |
Required |
Default |
string |
Yes |
undefined |
headers
Type |
Required |
Default |
object |
No |
undefined |
Type |
Required |
Default |
object |
No |
undefined |
Where we want to pull data from in the response from the object. This uses lodash.get method
.
Type |
Required |
Default |
string |
No |
undefined |
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 |
If the request fails and error_path is empty, use this as the message.
Type |
Required |
Default |
string |
No |
undefined |
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 |
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 |
This will prevent the form data from sending with POST, PATCH, and PUT requests.
Type |
Required |
Default |
boolean |
No |
false |
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 |
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 |