Configure Providers and Endpoints
masterPurest uses a configuration object to map providers to base URLs and paths. You can define a default endpoint for a provider or explicit endpoints for specific sub-services.
Default Endpoint
The default key defines the base configuration for the provider. Use tokens like {path} in the path field to allow appending sub-paths.
Explicit Endpoint
You can define specific endpoints (e.g., youtube inside a google provider) with their own origin, path, and tokens like {version} or {path}. This allows you to call the endpoint by name.
Example configuration:
{
"google": {
"default": {
"origin": "https://www.googleapis.com",
"path": "{path}",
"headers": { "authorization": "Bearer {auth}" }
},
"youtube": {
"origin": "https://www.googleapis.com",
"path": "youtube/{version}/{path}",
"version": "v3",
"headers": { "authorization": "Bearer {auth}" }
}
}
}