third-party search API template

更新时间:
复制 MD 格式

This template specifies the recommended format for API request parameters used to integrate third-party APIs with Miaosou.

Request information

  • Protocol: HTTP(S)

  • Header:

    • Request Method: POST

    • Content-Type: application/json

  • Authentication:

    • Authorization: {{Authentication information}}

    • For example:

      • Authorization: Basic ${BasicToken}

      • Authorization: Bearer ${BasicToken}

Request parameters

Field name

Field type

Required

Description

Example value

query

String

Yes

The search keyword.

Hangzhou Asian Games

current

Integer

No

The current page number. The default value is 1.

1

size

Integer

No

The number of data entries to return. The default value is 20.

20

includeContent

Boolean

No

Specifies whether to include the article body. The default value is true.

true

Response information

  • Header:

  • Content-Type: application/json

Response parameters

Field name

Field type

Description

Example value

success

Boolean

Indicates whether the request was successful.

true

code

String

The response code that is returned when a request fails.

Error

message

String

The error message for the response.

Internal error

data

List<Article>

The article data.

current

Integer

The current page number.

1

size

Integer

The number of data entries returned.

20

total

Integer

The total number of entries.

100

Article

Field name

Field type

Required

Description

Example value

source

String

Yes

The source of the article.

CCTV.com

title

String

Yes

The title of the article.

Hangzhou Asian Games

content

String

Yes

The content of the article.

Venue designs such as the "Big Lotus", "Small Lotus", "Big Jade Cong", and "Hangzhou Umbrella".

url

String

Yes

The URL of the article.

http://news.cctv.com/2023/08/29/ARTIZeHbELfOWLgviHk1IxGb230829.shtml

summary

String

No

The summary of the article.

If no summary is provided, the first n characters of the content are used.

pubTime

String

Yes

The publication time of the article.

2023-01-01 12:01:01

Examples

Request

curl -X POST --location '{{url}}' \
    -H 'Authorization: basic {{BasicToken}}' \
    -H 'Content-Type: application/json' \
    -d '{
          "query": "Hangzhou Asian Games"
        }'

Response

{
  "success": true,
  "code": "",
  "message": "",
  "data": [
    "source": "",
    "title": "",
    "content": "",
    "url": "",
    "summary": "Summary",
    "pubTime": "2023-01-01 12:01:01"
  ]
}