Skip to content

Requests

Deployments and Pipelines in UbiOps receive data through their REST API endpoint.

Before making a request, a Deployment or Pipeline should already have been created in the platform.

Deployment Requests using the WebApp

You can easily create deployment requests using the UbiOps WebApp. This comes in handy when testing if your deployment behaves as it should. The WebApp will create the API request for you.

You can test your deployment by going to the deployment version page.

  1. Click on Deployments in the sidebar on the left and then click on your deployment name and then on one of the versions. You should now be on the deployment version page.

  2. Now click CREATE DIRECT REQUEST and insert or upload the data you want to include in the test request. Click Create to create the request.

  3. When the deployment has finished processing you can see the results of your request.

Deployment Requests using the API

The following text describes how to send data to a Deployment or Pipeline using the UbiOps API and applies to both deployment as pipeline requests.

API Token

For sending data to a deployment through the UbiOps API you will need an API Token with the correct permissions.

You need to provide the project name, deployment name and version or pipeline name for which the request will be made. There are 2 types of requests: direct and batch requests. A direct request takes a single data point and keeps a connection open, after which the result is returned immediately. A batch request can take up to 250 data points (deployments) or 100 data points (pipelines), for which each of them, a separate request_id is returned with which the results can be retrieved at a later time.

  • Direct request is used to send one data point to the deployment. Available for deployments with both structured as plain input.
  • Batch request allows to send multiple data points to the deployment. Available for deployments with both structured as plain input.

To be able to make a deployment request, a deployment package should have been uploaded for the deployment version, which means the deployment version should be in active state.

  • Direct request is used to send one data point to the pipeline. Available for pipelines with both structured as plain input.
  • Batch request allows to send multiple data points to the pipeline. Available for pipeline with both structured as plain input.

In case of deployments/pipelines with structured input, you need to provide a JSON dictionary with the input fields of the deployment/pipeline as keys and the data as values. In case of batch request, you need to provide a list of dictionaries containing the input fields of the deployment/pipeline as keys and the data as values. In case of plain deployments, a single string or list of string input is required that will be sent as-is to the deployment. In case of batch request, a list of string input is required.

Making a batch request to a deployment in UbiOps

Info

If your deployment takes in a blob as input, you have to provide the id of the blob in the input.

Retrieve the request results through the API

The result of a direct request is always immediate, meaning that the result is returned as soon as its computed. If your deployment was idle before the request, this can take a bit longer than when the deployment was still active.

When you make a batch request, the following response is returned per data point:

[
  {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "status": "pending",
    "time_created": "2020-07-24T09:51:15.360Z"
  }
]

The status of the request is always pending upon initialization and will later change into processing, failed or completed.

After making the request, you can collect the result of the request with the request id returned upon making the request. You can either collect the result of a single request or the results of multiple requests.

For the results of one batch request, you can use the GET deployment requests method. For the results of one batch request, the GET pipeline requests method may be used.

The following actions are also permitted for batch requests:

  • Retrieve multiple batch deployment and pipeline requests: Retrieve the results of multiple batch requests in one call. This method takes in a list of the request id's.
  • Delete multiple batch deployment and pipeline requests: Delete the multiple batch requests in one call. This method takes in a list of the request id's. All batch requests that were not yet 'completed' or 'failed' are terminated.
  • List all batch deployment and pipeline requests: Give an overview of all batch requests for a deployment or pipeline. Selection and sorting options are available.
  • Delete a single batch deployment and pipeline request: Delete a single batch request and terminate it.

Requests Schedules

To make periodic requests to deployments and pipelines, you can use the Request Schedule functionality. See Requests Schedules for more information.