Skip to main content

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

  1. Click Endpoints in the header, then New Endpoint, and name your endpoint.
  2. In the Request Aliasing section, choose the deployment and version you want the URL to point at.
  3. 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.

branch: main
name: pricing_opt
version: 3
schemaVersion: 1

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 built-in version aliases like latest, or custom version aliases like v1.0 instead of version numbers for the version value.

Above, the key alias is just a label and can be any string. For more details on the file format, see request splitting wit git.