![Dynamic Input avatar](https://images.apifyusercontent.com/XrVzlfEi90jIal4mkuFN1a7ydLrgb3tPa4G_H1yVf0c/rs:fill:250:250/aHR0cHM6Ly9hcGlmeS1pbWFnZS11cGxvYWRzLXByb2QuczMuYW1hem9uYXdzLmNvbS9kYTNXNlZveDdyZ2JLM3RNMy9NcXdFcEcyeWZSaDRRTFlucy1pbnB1dF9waWMucG5n.webp)
Dynamic Input
Try for free
No credit card required
View all Actors![Dynamic Input](https://images.apifyusercontent.com/XrVzlfEi90jIal4mkuFN1a7ydLrgb3tPa4G_H1yVf0c/rs:fill:250:250/aHR0cHM6Ly9hcGlmeS1pbWFnZS11cGxvYWRzLXByb2QuczMuYW1hem9uYXdzLmNvbS9kYTNXNlZveDdyZ2JLM3RNMy9NcXdFcEcyeWZSaDRRTFlucy1pbnB1dF9waWMucG5n.webp)
![Dynamic Input](https://images.apifyusercontent.com/XrVzlfEi90jIal4mkuFN1a7ydLrgb3tPa4G_H1yVf0c/rs:fill:250:250/aHR0cHM6Ly9hcGlmeS1pbWFnZS11cGxvYWRzLXByb2QuczMuYW1hem9uYXdzLmNvbS9kYTNXNlZveDdyZ2JLM3RNMy9NcXdFcEcyeWZSaDRRTFlucy1pbnB1dF9waWMucG5n.webp)
Dynamic Input
useful-tools/dynamic-input
Try for free
No credit card required
Actor for calling other Actors with dynamic input
The code examples below show how to run the Actor and get its results. To run the code, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token, which you can find under Settings > Integrations in Apify Console. Learn more
1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with your Apify API token
4const client = new ApifyClient({
5 token: '<YOUR_API_TOKEN>',
6});
7
8// Prepare Actor input
9const input = {
10 "input": `// Available packages:
11 // - Apify Actor - https://docs.apify.com/sdk/js/reference/class/Actor
12 // - example:
13 // await Actor.pushData({ my : 'data'});
14 // - Axios - https://axios-http.com/
15 // - example:
16 // log.info(`Current IP is: ${(await Axios.get('https://ipinfo.io/json')).data.ip}`)
17 // - Moment.js - https://momentjs.com/
18 // - example:
19 // log.info(`Tomorrow is: ${moment().add(1, 'day').toISOString()}`)
20
21 const waitTime = Math.ceil(5 + Math.random() * 10);
22
23 return {
24 minWaitTime: waitTime,
25 maxWaitTime: waitTime + 2_000
26 }`,
27 "proxyConfiguration": {
28 "useApifyProxy": true
29 }
30};
31
32(async () => {
33 // Run the Actor and wait for it to finish
34 const run = await client.actor("useful-tools/dynamic-input").call(input);
35
36 // Fetch and print Actor results from the run's dataset (if any)
37 console.log('Results from dataset');
38 console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
39 const { items } = await client.dataset(run.defaultDatasetId).listItems();
40 items.forEach((item) => {
41 console.dir(item);
42 });
43})();
44
45// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs
Developer
Maintained by Community
Actor metrics
- 3 monthly users
- 3 stars
- 100.0% runs succeeded
- Created in Sep 2023
- Modified 4 months ago
Categories