File tree Expand file tree Collapse file tree 10 files changed +60
-39
lines changed
apify-api/openapi/code_samples/javascript Expand file tree Collapse file tree 10 files changed +60
-39
lines changed Original file line number Diff line number Diff line change 11import { ApifyClient } from 'apify-client' ;
22
3- const apifyClient = new ApifyClient ( { token : 'my-token' } ) ;
4- // Replace apify~my-sample-task with your task's ID or technical name
5- await apifyClient . task ( 'apify~my-sample-task' ) . delete ( ) ;
3+ const apifyClient = new ApifyClient ( {
4+ token : '<TOKEN>' ,
5+ } ) ;
6+ await apifyClient . task ( '<TASK ID>' ) . delete ( ) ;
Original file line number Diff line number Diff line change 11import { ApifyClient } from 'apify-client' ;
22
3- const apifyClient = new ApifyClient ( { token : 'my-token' } ) ;
4- // Replace apify~my-sample-task with your task's ID or technical name
5- const task = await apifyClient . task ( 'apify~my-sample-task' ) . get ( ) ;
3+ const apifyClient = new ApifyClient ( {
4+ token : '<TOKEN>' ,
5+ } ) ;
6+ const task = await apifyClient
7+ . task ( '<TASK ID>' )
8+ . get ( ) ;
69
710console . log ( task ) ;
Original file line number Diff line number Diff line change 11import { ApifyClient } from 'apify-client' ;
22
3- const apifyClient = new ApifyClient ( { token : 'my-token' } ) ;
4- // Replace apify~my-sample-task with your task's ID or technical name
5- const input = await apifyClient . task ( 'apify~my-sample-task' ) . getInput ( ) ;
3+ const apifyClient = new ApifyClient ( {
4+ token : '<TOKEN>' ,
5+ } ) ;
6+ const input = await apifyClient
7+ . task ( '<TASK ID>' )
8+ . getInput ( ) ;
69
710console . log ( input ) ;
Original file line number Diff line number Diff line change 11import { ApifyClient } from 'apify-client' ;
22
3- const apifyClient = new ApifyClient ( { token : 'my-token' } ) ;
4- // Replace apify~my-sample-task with your task's ID or technical name
5- const updatedInput = await apifyClient . task ( 'apify~my-sample-task' )
6- . updateInput ( {
7- // Your input here
8- } ) ;
3+ const apifyClient = new ApifyClient ( {
4+ token : '<TOKEN>' ,
5+ } ) ;
6+ const updatedInput = await apifyClient
7+ . task ( '<TASK ID>' )
8+ . updateInput ( { /** NEW INPUT */ } ) ;
99
1010console . log ( updatedInput ) ;
Original file line number Diff line number Diff line change 11import { ApifyClient } from 'apify-client' ;
22
3- const apifyClient = new ApifyClient ( { token : 'my-token' } ) ;
4- // Replace apify~my-sample-task with your task's ID or technical name
5- const task = await apifyClient . task ( 'apify~my-sample-task' ) . update ( {
6- title : 'New title' ,
3+ const apifyClient = new ApifyClient ( {
4+ token : '<TOKEN>' ,
75} ) ;
6+ const updatedTask = await apifyClient
7+ . task ( '<TASK ID>' )
8+ . update ( {
9+ title : 'New title' ,
10+ } ) ;
811
9- console . log ( task ) ;
12+ console . log ( updatedTask ) ;
Original file line number Diff line number Diff line change 11import { ApifyClient } from 'apify-client' ;
22
3- const apifyClient = new ApifyClient ( { token : 'my-token' } ) ;
4- // Replace apify~my-sample-task with your task's ID or technical name
5- const { items } = await apifyClient . task ( 'apify~my-sample-task' )
3+ const apifyClient = new ApifyClient ( {
4+ token : '<TOKEN>' ,
5+ } ) ;
6+ const { items } = await apifyClient
7+ . task ( '<TASK ID>' )
68 . runs ( )
79 . list ( ) ;
810
Original file line number Diff line number Diff line change 11import { ApifyClient } from 'apify-client' ;
22
3- const apifyClient = new ApifyClient ( { token : 'my-token' } ) ;
4- // Replace apify~my-sample-task with your task's ID or technical name
5- const run = await apifyClient . task ( 'apify~my-sample-task' ) . start ( ) ;
3+ const apifyClient = new ApifyClient ( {
4+ token : '<TOKEN>' ,
5+ } ) ;
6+ const run = await apifyClient
7+ . task ( '<TASK ID>' )
8+ . start ( ) ;
69
710console . log ( run ) ;
Original file line number Diff line number Diff line change 11import { ApifyClient } from 'apify-client' ;
22
3- const apifyClient = new ApifyClient ( { token : 'my-token' } ) ;
4- // Replace apify~my-sample-task with your task's ID or technical name
5- const { items } = await apifyClient . task ( 'apify~my-sample-task' )
3+ const apifyClient = new ApifyClient ( {
4+ token : '<TOKEN>' ,
5+ } ) ;
6+ const { items } = await apifyClient
7+ . task ( '<TASK ID>' )
68 . webhooks ( )
79 . list ( ) ;
810
Original file line number Diff line number Diff line change 11import { ApifyClient } from 'apify-client' ;
22
3- const apifyClient = new ApifyClient ( { token : 'my-token' } ) ;
4- const { items } = await apifyClient . tasks ( ) . list ( ) ;
3+ const apifyClient = new ApifyClient ( {
4+ token : '<TOKEN>' ,
5+ } ) ;
6+ const { items } = await apifyClient
7+ . tasks ( )
8+ . list ( ) ;
59
610console . log ( items ) ;
Original file line number Diff line number Diff line change 11import { ApifyClient } from 'apify-client' ;
22
3- const apifyClient = new ApifyClient ( { token : 'my-token' } ) ;
4- const { items } = await apifyClient . tasks ( ) . create ( {
5- /**
6- * Replace apify~my-sample-actor with the ID or technical name
7- * of the Actor this task will be based on
8- */
9- actId : 'apify~my-sample-actor' ,
10- name : 'my-sample-task' ,
3+ const apifyClient = new ApifyClient ( {
4+ token : '<TOKEN>' ,
115} ) ;
6+ const { items } = await apifyClient
7+ . tasks ( )
8+ . create ( {
9+ actId : '<ACTOR ID>' ,
10+ name : '<TASK NAME>' ,
11+ } ) ;
1212
1313console . log ( items ) ;
You can’t perform that action at this time.
0 commit comments