Connect Octoparse API step by step
FollowIn this tutorial, we will demonstrate how to connect Octoparse API step by step.
To start with, you might need to know that Octoparse provides Standard and Professional plans with different API service. For more detail, please refer to these two documents, standard API service and Advance API service.
Here are the main steps in this tutorial.
- Get a Token code
- Get API Connect
1) Get connected API
- Copy this URL: https://dataapi.octoparse.com/token
You can find this request link in the http://dataapi.octoparse.com/help.
- Paste the URL to start a new task with the Advanced mode
- Click “Extracted from JSON”
- Click “JASON request options”
- Select “POST” - “BODY”- “RAW”
- Copy and Paste this code into the RAW: username={userName}&password={password}&grant_type=password
- Replacing {userName} with your Octoparse account user name (don't keep the “{}“)
- Replacing {password} with your Octoparse account password (don't keep the “{}“)
- Click OK to save
- Now the “Tree” will give you feedback. If your token is successfully requested, you will see a return like this:
- Click “Text” nearby the "Tree" and find the Token code
Please note:
- The correct token code should be between "access_token" and "token_type" and without quotation marks.
- The token you've been given will only be valid for 24 hours.
2) Get API connected
- Open a new task in Octoparse
- Input this link: https://dataapi.octoparse.com/api/TaskGroup to start a new task and click “Save URL”
- Copy “Authorization” to “Input the key”
- Copy “bearer {access_token}” to "Input the Value":
- Replace {access_token} with the token code you get in the last step.
If the response is “success”, meaning that you have connected to Octoparse API successfully.
Please note that when you paste the token code in the "Value" column, leave a space between the "bearer" and the token.
Check here to find 5 Most Common API Requests on Octoparse.