Request aliasing
Request aliasing allows you to change the Modelbit deployment behind the URL without changing the URL. Request aliasing is useful when the Modelbit URL is checked into your web or mobile product, and you want to change the deployment that the product is calling without shipping a new version of the product.
Creating a request aliasing endpoint with the web app
- Click
Endpoints
in the header, thenNew Endpoint
, and name your endpoint. - In the
Request Aliasing
section, choose the deployment and version you want the URL to point at. - Save your endpoint and send a REST request to the URL to test it.
The endpoint forwards your request to the deployment, so send the same data format (and API key) you'd normally send directly to the deployment.
Creating a request aliasing endpoint with git
Endpoints are stored as .yaml
files in the endpoints
directory of your Modelbit git repo.
To create a new endpoint, create a new file in the endpoints
directory. The name of the file will be the name of the endpoint. Use only lowercase letters, numbers, and underscores in the file name. This example endpoint is called pricing_optimizer
.
backends:
alias:
deployment:
branch: main
name: pricing_opt
version: 3
schemaVersion: 1
For the full endpoint schema, see the endpoint YAML API reference.
Follow the format above and, in the deployment
section, set branch
, name
and version
to the deployment you want this endpoint to point at. You may use the version alias latest
instead of version numbers for the version
value.