目标
GET https://analytics.ospyo.com/api/goals/
curl --request GET \
--url 'https://analytics.ospyo.com/api/goals/' \
--header 'Authorization: Bearer {api_key}' \
--url 'https://analytics.ospyo.com/api/goals/' \
--header 'Authorization: Bearer {api_key}' \
| 参数 | 详情 | 描述 |
|---|---|---|
| website_id | 可选 整数 | |
| type | 可选 字符串 | 允许的值:pageview, custom |
| search | 可选 字符串 | 搜索字符串。 |
| search_by | 可选 字符串 | 您按哪个字段搜索。允许的值有:name, path, key。 |
| datetime_field | 可选 字符串 | 允许的值:datetime, last_datetime |
| datetime_start | 可选 字符串 | 筛选从此日期时间开始的结果。格式为 Y-m-d H:i:s。 |
| datetime_end | 可选 字符串 | 筛选截止到此日期时间的结果。格式为 Y-m-d H:i:s。 |
| order_by | 可选 字符串 | 按哪个字段对结果排序。允许的值有:goal_id, last_datetime, datetime, name, path, key。 |
| order_type | 可选 字符串 | 结果的排序方式。允许的值有:ASC 表示升序,DESC 表示降序。 |
| page | 可选 整数 | 您希望获取结果的页码。默认为 1。 |
| results_per_page | 可选 整数 | 您希望每页显示多少结果。允许的值有:10, 25, 50, 100, 250, 500, 1000。默认为 25。 |
{
"data": [
{
"id": 1,
"website_id": 1,
"user_id": 1,
"key": "123456789",
"type": "custom",
"path": null,
"name": "Example",
"datetime": "2026-05-25 16:32:15",
"last_datetime": null
},
],
"meta": {
"page": 1,
"results_per_page": 25,
"total": 1,
"total_pages": 1
},
"links": {
"first": "https://analytics.ospyo.com/api/goals?page=1",
"last": "https://analytics.ospyo.com/api/goals?page=1",
"next": null,
"prev": null,
"self": "https://analytics.ospyo.com/api/goals?page=1"
}
}
GET https://analytics.ospyo.com/api/goals/{goal_id}
curl --request GET \
--url 'https://analytics.ospyo.com/api/goals/{goal_id}' \
--header 'Authorization: Bearer {api_key}' \
--url 'https://analytics.ospyo.com/api/goals/{goal_id}' \
--header 'Authorization: Bearer {api_key}' \
{
"data": {
"id": 1,
"website_id": 1,
"user_id": 1,
"key": "123456789",
"type": "custom",
"path": null,
"name": "Example",
"datetime": "2026-05-25 16:32:15",
"last_datetime": null
}
}
POST https://analytics.ospyo.com/api/goals
| 参数 | 详情 | 描述 |
|---|---|---|
| website_id | 必需 整数 | - |
| type | 必需 字符串 | 允许的值:pageview, custom |
| name | 必需 字符串 | - |
| path | 可选 字符串 | 可用条件:type = pageview |
| key | 可选 字符串 | - |
curl --request POST \
--url 'https://analytics.ospyo.com/api/goals' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--form 'chart_datetime=2026-05-25 16:32:15' \
--url 'https://analytics.ospyo.com/api/goals' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--form 'chart_datetime=2026-05-25 16:32:15' \
{
"data": {
"id": 1
}
}
POST https://analytics.ospyo.com/api/goals/{goal_id}
| 参数 | 详情 | 描述 |
|---|---|---|
| website_id | 可选 整数 | - |
| type | 可选 字符串 | 允许的值:pageview, custom |
| name | 可选 字符串 | - |
| path | 可选 字符串 | 可用条件:type = pageview |
| key | 可选 字符串 | - |
curl --request POST \
--url 'https://analytics.ospyo.com/api/goals/{goal_id}' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--form 'is_enabled=0' \
--url 'https://analytics.ospyo.com/api/goals/{goal_id}' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--form 'is_enabled=0' \
{
"data": {
"id": 1
}
}
DELETE https://analytics.ospyo.com/api/goals/{goal_id}
curl --request DELETE \
--url 'https://analytics.ospyo.com/api/goals/{goal_id}' \
--header 'Authorization: Bearer {api_key}' \
--url 'https://analytics.ospyo.com/api/goals/{goal_id}' \
--header 'Authorization: Bearer {api_key}' \