Integrations
The integrations
API lets you build plugins integrating third-party API services into Qatium. The integrations API allows fetching HTTP requests through Qatium’s gateway, and managing user secrets for authentication and other uses.
The integrations.secrets
API lets you store and retrieve secret data for users and networks. Storing these secrets allows users to configure all required credentials for API integrations, such as usernames, passwords, API keys, API URLs, etc.
Secrets are stored safely in Qatium’s infrastructure, ensuring privacy and confidentiality.
Fetch API
fetch()
Performs an HTTP fetch proxied through Qatium’s API integration gateway. Behaves in the same way as the built-in fetch() method. Check the fetch method documentation to know more.
Resolves to no-op when running in developer mode unless your developer account is approved by Qatium to do third-party API integrations.
Using secrets
The fetch API works in combination with the Secrets API to provide a secure way of integrating with third-party APIs.
You can use the stored secrets in the API requests using the format $(secret:SECRET_KEY)
where SECRET_KEY
is the name of
the stored secret.
You can find an example of how to combine secrets in API integrations in this example.
Parameters
input
: URL as a string, URL Object, or Request object.init
: (Optional) HTTP request options.
Returns
A promise resolving with the HTTP response.
Example
Perform a request to a third-party API:
Perform a request to a third-party API using secrets:
Secrets
secrets.get()
Returns a secret value by name.
Resolves to no-op when running in developer mode unless your developer account is approved by Qatium to do third-party API integrations.
Method signature
Parameters
key
: Secret name.
Returns
A promise that resolves after the secret value is retrieved from Qatium’s infrastructure. If the secret does not exist or an error occurs, an empty string (""
) will be returned.
Example
secrets.has()
Returns whether a secret exists by name.
Resolves to no-op when running in developer mode unless your developer account is approved by Qatium to do third-party API integrations.
Method signature
Parameters
key
: Secret name.
Returns
A promise that resolves after verifying whether the secret exists in Qatium’s infrastructure. If the secret does not exist or an error occurs, false
will be returned.
Example
secrets.set()
Sets the value for a secret by key.
Resolves to no-op when running in developer mode unless your developer account is approved by Qatium to do third-party API integrations.
Method signature
Parameters
key
: Secret name.value
: Secret value.
Returns
A promise that resolves after the secret value has been updated. The returned value informs whether the operation has succeeded or failed.