5 Most Common API Questions in Octoparse
FollowQuestion: I get an invalid_grant when trying to get a token.
{"error":"invalid_grant","error_description":"This feature is unavailable. You don't have the required account privileges."}
Answer: if you saw an error reported as: “This feature is unavailable. You don’t have the required account privileges.”
It is because the Advanced API is only available for Professional Plan users.
You can use Data API for Standard Plan: http://dataapi.octoparse.com
Question: When getting OAuth Token, whatever I try to post to the API it returns {"error":"unsupported_grant_type"}
Answer: please make sure you add this parameter(username={userName}&password={password}&grant_type=password) into the request body not the request URL.
Question: How can I get the next 1000 rows using non-exported data endpoint using API?
Answer: if you have exported the first batch of non-exported data, please change the status of the exported data first:
http://advancedapi.octoparse.com/help#_actions_NotExportDataSetExportingDataAsExported
Then you can get the next 1000 rows by using http://advancedapi.octoparse.com/help#_actions_NotExportDataSelectTop
Question: What do the error responses mean?
Answer: whenever an error code appears, please refer to the following status code to solve the problem.
Question: How to write a task parameter name?
Answer:
You can modify the task parameter setting with the API. Each step in the workflow has a unique name. The task parameter name is the combination of a unique name and a default suffix.
There are four kinds of default suffixes in Octoparse.
Steps |
Default suffix |
Task parameter name = a unique name+a default suffix |
Navigate / Go To Web Page |
Url |
eg. navigateAction1.Url |
Loop |
UrlList |
eg. loopAction1.UrlList |
TextList |
eg. loopAction1.TextList |
|
Enter the text |
Text |
eg. enterTextAction1.Text |
To write a task parameter name, you can follow the steps below:
Step 1: Open Octoparse to get a unique name.
Hover your mouse on one step in the workflow, and there is a note popping up. that’s where the unique name is.
Step 2. Combine the unique name with the corresponding default suffix.
For example:
The unique name for "Go To Web Page" is "navigateAction1". So the task parameter name is "navigateAction1.Url"
The unique name for "Enter Text" is "enterTextAction1". So the task parameter name is "enterTextAction1.Text"
The unique name for "Loop" is "loopAction4". So the task parameter name is "loopAction1.TextList" or "loopAction1.UrlList", depending on the loop contents.
Artículo en español: 5 solicitudes comunes de API
También puede leer artículos de web scraping en el sitio web oficial
Writer: Yanni
Editor: Yina