Magi API 使用说明
鉴权机制
发起请求时,需在请求 headers 中添加 Authorization 字段。
Authorization 字段的值的格式为:APPCODE + 半角空格 +APPCODE值
其中 APPCODE值
为此前发送到您电子邮箱中的,32 个字符的十六进制字符串,且大小写敏感。
调用样例:
$ curl -X GET -H "Authorization:APPCODE 9cc873cfa72f5f6696f6c07c6f66d23d" \
"https://graph.api.magi.com/v1/facts"
该 APPCODE值
为统计 API 调用频次的唯一凭证,请勿泄露给第三方。当每日限额耗尽或授权过期时,API 服务将不再返回结果,而是 429
状态码。
若需额外的调用次数以进行评估,请联系 Peak Labs。
接口详情
graph/list_clue
方法 | 协议 | 路径 | 描述 |
---|
GET | https | graph.api.magi.com/v1/clues | Return list of clues matching the given criteria |
参数名 | 参数位置 | 类型 | 必填 | 默认值 | 描述 |
---|
skip | Query | Int | false | 0 | Number of resources to skip |
limit | Query | Int | false | 10 | Maximum number of resources to return |
graph/list_entity
方法 | 协议 | 路径 | 描述 |
---|
GET | https | graph.api.magi.com/v1/entities | Return list of entities matching the given criteria |
参数名 | 参数位置 | 类型 | 必填 | 默认值 | 描述 |
---|
query | Query | String | false | "" | Query string to search against |
subject | Query | []String | false | [] | Filter resources matching one of the subjects |
sense | Query | String | false | "" | Sense of the resources |
order | Query | String | false | "" | Sorting preference of sub-level resources |
skip | Query | Int | false | 0 | Number of resources to skip |
limit | Query | Int | false | 10 | Maximum number of resources to return |
graph/list_fact
方法 | 协议 | 路径 | 描述 |
---|
GET | https | graph.api.magi.com/v1/facts | Return list of facts matching the given criteria |
参数名 | 参数位置 | 类型 | 必填 | 默认值 | 描述 |
---|
query | Query | String | false | "" | Query string to search against |
scheme | Query | String | false | "" | Filter resources matching the scheme |
subject | Query | []String | false | [] | Filter resources matching one of the subjects |
predicate | Query | []String | false | [] | Filter resources matching one of the predicate |
object | Query | []String | false | [] | Filter resources matching one of the object |
skip | Query | Int | false | 0 | Number of resources to skip |
limit | Query | Int | false | 10 | Maximum number of resources to return |
graph/list_node
方法 | 协议 | 路径 | 描述 |
---|
GET | https | graph.api.magi.com/v1/nodes | Return list of nodes matching the given criteria |
参数名 | 参数位置 | 类型 | 必填 | 默认值 | 描述 |
---|
query | Query | String | false | "" | Query string to search against |
subject | Query | []String | false | [] | Filter resources matching one of the subjects |
object | Query | []String | false | [] | Filter resources matching one of the object |
skip | Query | Int | false | 0 | Number of resources to skip |
limit | Query | Int | false | 10 | Maximum number of resources to return |
graph/list_set
方法 | 协议 | 路径 | 描述 |
---|
GET | https | graph.api.magi.com/v1/sets | Return list of sets matching the given criteria |
参数名 | 参数位置 | 类型 | 必填 | 默认值 | 描述 |
---|
query | Query | String | false | "" | Query string to search against |
scheme | Query | String | false | "" | Filter resources matching the scheme |
subject | Query | []String | false | [] | Filter resources matching one of the subjects |
predicate | Query | []String | false | [] | Filter resources matching one of the predicate |
object | Query | []String | false | [] | Filter resources matching one of the object |
sense | Query | String | false | "" | Sense of the resources |
order | Query | String | false | "" | Sorting preference of sub-level resources |
skip | Query | Int | false | 0 | Number of resources to skip |
limit | Query | Int | false | 10 | Maximum number of resources to return |
graph/list_teaser
方法 | 协议 | 路径 | 描述 |
---|
GET | https | graph.api.magi.com/v1/teasers | Return list of teasers matching the given criteria |
参数名 | 参数位置 | 类型 | 必填 | 默认值 | 描述 |
---|
query | Query | String | false | "" | Query string to search against |
inclusive | Query | Boolean | false | true | Include exact matches | skip | Query | Int | false | 0 | Number of resources to skip |
limit | Query | Int | false | 10 | Maximum number of resources to return |
graph/get_clue
方法 | 协议 | 路径 | 描述 |
---|
GET | https | graph.api.magi.com/v1/clues/[id] | Get clue by ID |
参数名 | 参数位置 | 类型 | 必填 | 默认值 | 描述 |
---|
id | Path | String | true | - | ID of the target resource |
graph/get_entity
方法 | 协议 | 路径 | 描述 |
---|
GET | https | graph.api.magi.com/v1/entities/[id] | Get entity by ID |
参数名 | 参数位置 | 类型 | 必填 | 默认值 | 描述 |
---|
id | Path | String | true | - | ID of the target resource |
graph/get_fact
方法 | 协议 | 路径 | 描述 |
---|
GET | https | graph.api.magi.com/v1/facts/[id] | Get fact by ID |
参数名 | 参数位置 | 类型 | 必填 | 默认值 | 描述 |
---|
id | Path | String | true | - | ID of the target resource |
graph/get_node
方法 | 协议 | 路径 | 描述 |
---|
GET | https | graph.api.magi.com/v1/nodes/[id] | Get node by ID |
参数名 | 参数位置 | 类型 | 必填 | 默认值 | 描述 |
---|
id | Path | String | true | - | ID of the target resource |
graph/get_set
方法 | 协议 | 路径 | 描述 |
---|
GET | https | graph.api.magi.com/v1/sets/[id] | Get set by ID |
参数名 | 参数位置 | 类型 | 必填 | 默认值 | 描述 |
---|
id | Path | String | true | - | ID of the target resource |
graph/get_teaser
方法 | 协议 | 路径 | 描述 |
---|
GET | https | graph.api.magi.com/v1/teasers/[id] | Get tesaser by ID |
参数名 | 参数位置 | 类型 | 必填 | 默认值 | 描述 |
---|
id | Path | String | true | - | ID of the target resource |
返回值
返回值的结构大致相同,故不单独介绍。若想了解具体资源的详细信息,请开发者调用相应接口即可。
- 列表类型成功返回:
{
"data": [
{
"_id": "xxx" // 资源的唯一 ID,用于单独 GET
...
}, ...
]
}
- 资源类型成功返回:
{
// 单个资源的详情
}
- 失败返回:
{
"error":{
"code": `HTTP_STATUS_CODE`,
"message": `MESSAGE`
}
}