ApifyClient.API.Builds (apify_client v1.0.0)

Copy Markdown View Source

Provides API endpoints related to api/builds

Summary

Functions

Abort Actor build

Delete Actor build

Get Actor build

Get list of user's Actor builds

Get Actor build's log

Get OpenAPI definition of Actor build

Types

abort_200_json_resp()

@type abort_200_json_resp() :: %{data: ApifyClient.Schemas.Build.t() | nil}

get_200_json_resp()

@type get_200_json_resp() :: %{data: ApifyClient.Schemas.Build.t() | nil}

Functions

abort(build_id, opts \\ [])

@spec abort(build_id :: String.t(), opts :: keyword()) ::
  {:ok, ApifyClient.Schemas.Build.t()} | {:error, ApifyClient.Error.t()}

Abort Actor build

Aborts an Actor build and returns an object that contains all the details about the build.

Only builds that are starting or running are aborted. For builds with status FINISHED, FAILED, ABORTING and TIMED-OUT this call does nothing.

delete(build_id, opts \\ [])

@spec delete(build_id :: String.t(), opts :: keyword()) ::
  :ok | {:error, ApifyClient.Error.t()}

Delete Actor build

Delete the build. The build that is the current default build for the Actor cannot be deleted.

Only users with build permissions for the Actor can delete builds.

get(build_id, opts \\ [])

@spec get(build_id :: String.t(), opts :: keyword()) ::
  {:ok, ApifyClient.Schemas.Build.t()} | {:error, ApifyClient.Error.t()}

Get Actor build

Gets an object that contains all the details about a specific build of an Actor.

By passing the optional waitForFinish parameter the API endpoint will synchronously wait for the build to finish. This is useful to avoid periodic polling when waiting for an Actor build to finish.

This endpoint does not require the authentication token. Instead, calls are authenticated using a hard-to-guess ID of the build. However, if you access the endpoint without the token, certain attributes, such as usageUsd and usageTotalUsd, will be hidden.

Options

  • wait_for_finish: The maximum number of seconds the server waits for the build to finish. By default it is 0, the maximum value is 60. <!-- MAX_ACTOR_JOB_ASYNC_WAIT_SECS --> If the build finishes in time then the returned build object will have a terminal status (e.g. SUCCEEDED), otherwise it will have a transitional status (e.g. RUNNING).

list(opts \\ [])

@spec list(opts :: keyword()) ::
  {:ok, ApifyClient.Schemas.ListOfBuilds.t()} | {:error, ApifyClient.Error.t()}

Get list of user's Actor builds

Gets a list of all builds for a user. The response is a JSON array of objects, where each object contains basic information about a single build.

The endpoint supports pagination using the limit and offset parameters and it will not return more than 1000 records.

By default, the records are sorted by the startedAt field in ascending order. Therefore, you can use pagination to incrementally fetch all builds while new ones are still being started. To sort the records in descending order, use the desc=1 parameter.

Options

  • offset: Number of items that should be skipped at the start. The default value is 0.

  • limit: Maximum number of items to return. The default value as well as the maximum is 1000.

  • desc: If true or 1 then the objects are sorted by the startedAt field in descending order. By default, they are sorted in ascending order.

log(build_id, opts \\ [])

@spec log(build_id :: String.t(), opts :: keyword()) ::
  {:ok, String.t()} | {:error, ApifyClient.Error.t()}

Get Actor build's log

Retrieves Actor build's logs.

This endpoint is a shortcut for getting the build's log. Same as Get Actor build or run log endpoint.

Options

  • stream: If true or 1 then the logs will be streamed as long as the run or build is running.

  • download: If true or 1 then the web browser will download the log file rather than open it in a tab.

openapi_json(build_id, opts \\ [])

@spec openapi_json(build_id :: String.t(), opts :: keyword()) ::
  {:ok, map() | nil} | {:error, ApifyClient.Error.t()}

Get OpenAPI definition of Actor build

Get the OpenAPI definition for Actor builds. Two similar endpoints are available:

Get the OpenAPI definition for a specific Actor build.

This endpoint doesn't require the authentication token if the Actor is public or if the build's owner has general resource access set to Anyone with ID can read. Otherwise, the token must have access to the build.

:::note

You can also use the Get OpenAPI definition of Actor build endpoint (/v2/actors/{actorId}/builds/{buildId}/openapi.json) to get the OpenAPI definition for a build.

:::