Moving from v4 to v5 V5 (beta)
The order for switching v4 calls to v5, and what changed.
v4 keeps working as it is (no end date is set, and we will tell you first when one is). There is no rush to move, but you need v5 to give a bot several plans or to read which plan made a collection. The same API key is used.
First of all: the default of save_to_settings flipped
The default of v4 settings.param_save was false (apply to this collection only). The default of v5 save_to_settings is true: the inputs you send are saved to the bot settings, and the automatic conditions of the plan that follows the bot settings change too (the same behavior as the screen). Code that used the v4 "this once" behavior must add save_to_settings: false explicitly when you move it.
Path mapping
| v4 | v5 |
|---|---|
GET /v4/api/health, /me | GET /v5/api/health, /me (same) |
GET /schedules | GET /bots |
| (none) | GET /bots/{bot_id}: one bot |
GET /schedules/{id}/param_info | GET /bots/{bot_id}/inputs (field definitions) + GET /bots/{bot_id}/settings (current values) |
PATCH /schedules/{id}: params | PATCH /bots/{bot_id}/settings: inputs |
PATCH /schedules/{id}: settings.union | PATCH /bots/{bot_id}/settings: union |
PATCH /schedules/{id}: settings.period | Plans /bots/{bot_id}/plans, /plans/{plan_id} |
PUT /schedules/{id}/excel_param | PUT /bots/{bot_id}/settings/excel |
POST /schedules/{id}/collections | POST /bots/{bot_id}/collections |
POST /collections/bulk | POST /collections/bulk |
GET /schedules/{id}/schedule_results | GET /datasets?bot_id={bot_id} |
GET /schedule_results/{id} | GET /datasets/{dataset_id} |
POST /schedule_results/{id}/retry, /cancel | POST /datasets/{dataset_id}/retry, /cancel |
GET /schedule_results/{id}/results | GET /datasets/{dataset_id}/results |
GET /schedules/{id}/results | No matching path. Find the latest dataset with GET /datasets?bot_id=…&limit=1 and read /datasets/{dataset_id}/results. |
POST /commerce/schedules | Not in v5 (keep using it on v4). |
Resource and field name mapping
| v4 | v5 | Note |
|---|---|---|
schedules, schedule_id | bots, bot_id (id in responses) | The bot ID value is the same. |
schedule_results, schedule_result_id | datasets, dataset_id (id in responses) | The number is the same. |
param_info | inputs | Definitions are at /inputs and values at /settings. |
params | inputs | Keys stay paramN or alias. |
settings.param_save | save_to_settings | Default flips from false to true |
settings.period | plans (when) | See the table below. |
sr_status | status | The values changed too. See the table below. |
SCHEDULE_NOT_FOUND, SCHEDULE_RESULT_NOT_FOUND | BOT_NOT_FOUND, DATASET_NOT_FOUND | Other error code names are unchanged. |
settings.period → plans
In v4 a bot had a single plan (manual, hour or day). In v5 you create plans as plans and give when the schedule.
| v4 <code>settings.period</code> | v5 |
|---|---|
manual | Turn the plan off with PATCH { "enabled": false }. |
hour | { "type": "interval", "minutes": 60 } |
day | { "type": "daily", "times": ["00:00"] } |
Status value mapping
v5 returns one English code only. The Korean and English labels that v4 sometimes returned (완료, Complete and so on) are gone.
| v4 <code>sr_status</code> | v5 <code>status</code> |
|---|---|
ready | waiting |
running | running |
retry | retrying |
finish, complete | done (attention when a notice is attached) |
canceling, canceled | canceling, canceled |
| (failed collection) | failed: newly distinguished in v5. |
What changed
- There are several plans. The single
settings.periodof v4 became severalplans. Each plan runs with its own conditions, and only plan 1 follows the bot settings. Datasets and webhooks tell you which plan it was (trigger,plan) and the conditions used (inputs). Multiple plans are opened per account, so when they are not open the plan paths return404. - An idempotency key is required. Starting a collection, running a plan now, bulk collection, creating a plan and retry give
400without theIdempotency-Keyheader. See the rules. - There is no Excel collection yet. Uploading Excel (
PUT /bots/{bot_id}/settings/excel) works, but collecting for a bot withinput_mode: excelgivesEXCEL_NOT_SUPPORTED_YET. Keep using v4 for bots that collect with Excel. - Fields always have the same shape. A missing value arrives as
nullor an empty array instead of being left out. - A new collection can overlap. You can start a new collection even if the previous one has not finished (
ALREADY_RUNNINGis for retry only).
Example of changing a call
The same "collect this once with this keyword" written in v4 and in v5.
# v4
curl -X POST 'https://www.hashscraper.com/v4/api/schedules/8f3a7c1e9b5d24f6/collections' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "params": { "param1": "sneakers" }, "settings": { "param_save": false } }'curl -X POST 'https://www.hashscraper.com/v5/api/bots/8f3a7c1e9b5d24f6/collections' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H "Idempotency-Key: $(uuidgen)" \
-H 'Content-Type: application/json' \
-d '{
"inputs": {
"param1": "sneakers"
},
"save_to_settings": false
}'# v4
curl 'https://www.hashscraper.com/v4/api/schedule_results/239758028' \
-H 'Authorization: Bearer YOUR_API_KEY'curl 'https://www.hashscraper.com/v5/api/datasets/239758028' \
-H 'Authorization: Bearer YOUR_API_KEY'Checklist when you move
- Did you change the address
/v4/api→/v5/apiand the paths and field names as in the tables above? - Did you add
save_to_settings: falseto collection requests that used the "this once" behavior? - Do collection starts, plan creation and retry send a new
Idempotency-Keyper request, reusing a key only inside the retry loop? - Do you branch on the new
statusvalues (done,waiting,retrying,attention,failed)? - Do you branch errors on
codeand handle the new error codes? - Can the side that receives your webhook handle the new fields (
trigger,plan,inputs)? (Existing fields are unchanged.)