You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/academy/expert_scraping_with_apify/apify_api_and_client.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ There are two main ways to programmatically interact with the Apify platform: by
16
16
17
17
- Scroll through the [Apify API docs](https://docs.apify.com/api/v2) (there's a whole lot there, so you're not expected to memorize everything).
18
18
- Read about the Apify client in [Apify's docs](https://docs.apify.com/apify-client-js). It can also be seen on [Github](https://github.com/apify/apify-client-js) and [NPM](https://www.npmjs.com/package/apify-client).
19
-
- Learn about the [`Apify.newClient()`](https://sdk.apify.com/docs/api/apify#apifynewclientoptions) function in the Apify SDK.
19
+
- Learn about the [`Actor.newClient()`](https://sdk.apify.com/docs/api/apify#apifynewclientoptions) function in the Apify SDK.
20
20
- Skim through [this article](https://help.apify.com/en/articles/2868670-how-to-pass-data-from-web-scraper-to-another-actor) about API integration (this article is old; however, still relevant).
## [](#calling-a-task-via-client) Calling a task via JavaScript client
34
35
35
-
When using the `apify-client` package, you can create a new client instance by using `new ApifyClient()`. Within the Apify SDK however, it is not necessary to even install the `apify-client` package, as the `Apify.newClient()` function is available for use.
36
+
When using the `apify-client` package, you can create a new client instance by using `new ApifyClient()`. Within the Apify SDK however, it is not necessary to even install the `apify-client` package, as the `Actor.newClient()` function is available for use.
36
37
37
38
We'll start by creating a function called `withClient()` and creating a new client, then calling the task:
38
39
39
40
```JavaScript
40
41
constwithClient=async () => {
41
-
constclient=Apify.newClient();
42
+
constclient=Actor.newClient();
42
43
consttask=client.task(TASK);
43
44
44
45
const { id } =awaittask.call({ memory });
@@ -49,7 +50,7 @@ After the task has run, we'll grab hold of its dataset, then attempt to download
0 commit comments