ApifyClient.API.Schedules (apify_client v1.0.0)

Copy Markdown View Source

Provides API endpoints related to api/schedules

Summary

Functions

create(body, opts \\ [])

Create schedule

Creates a new schedule with settings provided by the schedule object passed as JSON in the payload. The response is the created schedule object.

The request needs to specify the Content-Type: application/json HTTP header!

When providing your API authentication token, we recommend using the request's Authorization header, rather than the URL. For details, see Authentication.

Request Body

Content Types: application/json

delete(schedule_id, opts \\ [])

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

Delete schedule

Deletes a schedule.

get(schedule_id, opts \\ [])

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

Get schedule

Gets the schedule object with all details.

invoke(schedule_id, opts \\ [])

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

Invoke schedule

Immediately runs all actions of the schedule, the same way as the Run now button in Apify Console.

The invocation is recorded in the schedule log. It doesn't change the schedule's lastRunAt or nextRunAt. The response doesn't contain the started runs.

list(opts \\ [])

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

Get list of schedules

Gets the list of schedules that the user created.

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

By default, the records are sorted by the createdAt field in ascending order. 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 createdAt field in descending order. By default, they are sorted in ascending order.

log(schedule_id, opts \\ [])

@spec log(schedule_id :: String.t(), opts :: keyword()) ::
  {:ok, [ApifyClient.Schemas.ScheduleLogEntry.t()]}
  | {:error, ApifyClient.Error.t()}

Get schedule log

Gets the schedule log as a JSON array containing information about up to a 1000 invocations of the schedule.

update(schedule_id, body, opts \\ [])

@spec update(
  schedule_id :: String.t(),
  body :: map() | ApifyClient.Schemas.CreateOrUpdateScheduleRequest.t(),
  opts :: keyword()
) :: {:ok, ApifyClient.Schemas.Schedule.t()} | {:error, ApifyClient.Error.t()}

Update schedule

Updates a schedule using values specified by a schedule object passed as JSON in the POST payload. If the object does not define a specific property, its value will not be updated.

The response is the full schedule object as returned by the Get schedule endpoint.

The request needs to specify the Content-Type: application/json HTTP header!

When providing your API authentication token, we recommend using the request's Authorization header, rather than the URL. For details, see Authentication.

Request Body

Content Types: application/json