Skip to content

Commit

Permalink
feat: add API documentation for Actor charge (#1325)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhamas authored Dec 19, 2024
1 parent 12f27b8 commit 54fe91e
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
title: ChargeRunRequest
required:
- eventName
- eventCount
type: object
properties:
eventName:
type: string
example: ANALYZE_PAGE
eventCount:
type: number
example: 1
4 changes: 4 additions & 0 deletions apify-api/openapi/components/tags.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,10 @@
x-displayName: Resurrect run
x-parent-tag-name: Actor runs
x-trait: 'true'
- name: Actor runs/Charge events in run
x-displayName: Charge events in run
x-parent-tag-name: Actor runs
x-trait: 'true'
- name: Actor runs/Update status message
x-displayName: Update status message
x-parent-tag-name: Actor runs
Expand Down
1 change: 1 addition & 0 deletions apify-api/openapi/components/x-tag-groups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
- Actor runs/Metamorph run
- Actor runs/Reboot run
- Actor runs/Resurrect run
- Actor runs/Charge events in run
- Actor runs/Update status message
- name: Actor builds
tags:
Expand Down
2 changes: 2 additions & 0 deletions apify-api/openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,8 @@ paths:
$ref: paths/actor-runs/actor-runs@{runId}@reboot.yaml
'/v2/actor-runs/{runId}/resurrect':
$ref: paths/actor-runs/actor-runs@{runId}@resurrect.yaml
'/v2/actor-runs/{runId}/charge':
$ref: paths/actor-runs/actor-runs@{runId}@charge.yaml
/v2/actor-builds:
$ref: paths/actor-builds/actor-builds.yaml
'/v2/actor-builds/{buildId}':
Expand Down
46 changes: 46 additions & 0 deletions apify-api/openapi/paths/actor-runs/actor-runs@{runId}@charge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
post:
tags:
- Actor runs/Charge events in run
summary: Charge events in run
description: |
Charge for events in the run of your [pay per event Actor](https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event).
The event you are charging for must be one of the configured events in your Actor. If the Actor is not set up as pay per event, or if the event is not configured,
the endpoint will return an error. The endpoint must be called from the Actor run itself, with the same API token that the run was started with.
Note that pay per events Actors are still in alpha. Please, reach out to us with any questions or feedback.
operationId: PostChargeRun
parameters:
- name: runId
in: path
required: true
schema:
type: string
example: 3KH8gEpp4d8uQSe8T
description: Run ID.
- name: idempotency-key
in: header
required: false
schema:
type: string
example: 2024-12-09T01:23:45.000Z-random-uuid
description: Always pass a unique idempotency key (any unique string) for each charge to avoid double charging in case of retries or network errors.
requestBody:
description: 'Define which event, and how many times, you want to charge for.'
content:
application/json:
schema:
$ref: "../../components/schemas/actor-runs/ChargeRunRequest.yaml"
example:
eventName: 'ANALYZE_PAGE'
eventCount: 1
required: true
responses:
'201':
description: 'The charge was successful. Note that you still have to make sure in your Actor that the total charge for the run respects the maximum value set by the user, as the API does not check this. Above the limit, the charges reported as successful in API will not be added to your payouts, but you will still bear the associated costs. Use the Apify charge manager or SDK to avoid having to deal with this manually.'
deprecated: false
x-js-parent: RunClient
x-js-name: charge
x-js-doc-url: https://docs.apify.com/api/client/js/reference/class/RunClient#charge
x-py-parent: RunClientAsync
x-py-name: charge
x-py-doc-url: https://docs.apify.com/api/client/python/reference/class/RunClientAsync#charge

0 comments on commit 54fe91e

Please sign in to comment.