Getting started
Accessing the API
The API is made available via HTTP request. You can generate API Keys in the CoolParse Console.
Base URL is https://openapi.coolparse.com
.
Authentication
All requests to the API must include an Authorization
header with your API key, as Bearer {key}
, e.g. Authorization: Bearer sk-xxx
.
Content types
The API always accepts JSON in request bodies and returns JSON in response bodies. You will need to send the content-type: application/json
header in requests.
Other global headers
Header | Description |
---|---|
x-cp-request-id | You should generate a UUID for tracing the request. |
Response
Return 200 HTTP status when request is successful.
Body
Using fixed data structure, include code
, msg
, data
fields.
Field | Description |
---|---|
code | 0 means request is successful, otherwise failed. Others please refer to the Error codes chapter. |
msg | Hint message for error. |
data | Its data structure depends on interfaces, generally speaking, it has value only when the request is successful. |
json
{
"code": 0,
"msg": "",
"data": "true"
}
Pagination
request parameters
Parameter | Description |
---|---|
page | Page index, starting from 1. Date item offset is equal to (page -1) * size |
size | Size of page. |
Example https://openapi.coolparse.com/cloud/batches?page=1&size=10
.
response
Field | Description |
---|---|
page | Echo of request |
size | Echo of request |
total | Total count of data items that match the query parameters. |
Example
{
"code": 0,
"data": {
"list": [
{}
],
"pagination": {
"page": 1,
"size": 10,
"total": 23
}
}
}
Examples
shell
curl --location --request POST 'https://openapi.coolparse.com/cloud/stop' \
--header 'Authorization: Bearer sk-xxx' \
--header 'Content-Type: application/json' \
--header 'x-cp-request-id: 26387cf4-b166-4487-aab0-052cc64267e0' \
--data-raw '{ "taskID": "9b57f4b8-c5d5-44ac-b4be-52ea63ae4742" }'
response
json
{
"code": 0,
"data": {
"list": [
{
"batchID": 56692473407440,
"taskID": "da18d43c-4958-4e67-9d76-ee292006b552",
"createTime": 1731744923000,
"updateTime": 1731744953000,
"startTime": 1731744923000,
"endTime": 1731744953000,
"useTime": 30178,
"lineCount": 32,
"duplicatedCount": 0,
"captchaCount": 0,
"ipProxyUsage": 0,
"region": "",
"nodeCount": 1,
"jobCount": 1,
"status": 3,
"fields": [
{
"id": "91ca1f16-36b8-4e8d-975d-d8a3fbd91bd4",
"name": "asni"
},
{
"id": "6a3173c9-64f3-4348-8ec0-622f29252d48",
"name": "title"
}
]
}
],
"pagination": {
"page": 1,
"size": 10,
"total": 1
}
}
}
Error codes
Code | Description |
---|---|
9000000 | Failed to parse parameters, such as data type not match, miss required field. |
9000001 | Invalid parameters, such as value out of range. |
9000002 | Bad request. |
9000003 | Unauthorized access. |
9000004 | Resource not found |
9000005 | Resource is alreay exists. |