API call examples
Check out the FoAz Proxy Config API
A Proxy Config is a Permit.io resource that defines a protected API call. It is used to define the API call, and the secrets that should be injected into it.
Create a Proxy Config
When creating a Proxy Config you need to provide the following information:
A mapping rule is an object that defines how Permit will map the request to a resource / action.
There are a few things you need to take care about, when creating a proxy config:
The url path should be a valid openapi url with the host, for example,
Proxying a request to
https://api.stripe.com/v1/customers/:id
would behttps://api.stripe.com/v1/customers/{id}
If you want to enforce any headers, you need to provide them in the
headers
key of the mapping rule.If you want to enforce specific query parameters, provide them in the url using ? and &. For example, if you want to enforce the
limit
query parameter, you would provide the url ashttps://api.stripe.com/v1/customers?limit={limit}
If you have a url that is matched by multiple mapping rules, for example
https://api.stripe.com/v1/customers?limit={limit}
andhttps://api.stripe.com/v1/customers
the order is randomly unless you provide the priority to the mapping rule ( the default priority used is 0 ).The auth mechanism can be either Bearer, Basic, or Headers. If you choose Headers, you need to provide an object with the keys being the names, and the value being the values of the headers. If you choose Basic, you need to provide a secret in the format of
username:password
. If you choose Bearer, you need to provide any secret string.If you don't provide the action to the mapping rule, the http_method will be used as default.
Edit a Proxy Config
When updating a Proxy Config you need to provide the following information:
There are a few things you need to take care about, when updating a proxy config:
- If you update the secret without updating the auth_mechanism notice that it should match the proxy config auth_mechanism.
- If you update the auth_mechanism without updating the secret notice that it should match the proxy config secret format.
- If you update the mapping rules, you need to provide the entire mapping rules array, and not just the updated mapping rule.
Delete a Proxy Config
When deleting a Proxy Config you need to provide the following information: