Skip to main content

third-party search API template

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

Request specifications

Endpoints and methods

  • Protocol: HTTP(S)
  • Method:
    • POST

Request headers

  • Content-Type: application/json

Authentication

Miaosou passes authentication information in the Authorization field of the HTTP header. The following formats are supported:
  • Authorization: Basic ${BasicToken}
  • Authorization: Bearer ${BasicToken}

Request body

The request body is in the application/json format. The parameters are described as follows:

Field name

Field type

Required

Description

Example value

query

String

Yes

Search keyword

"Hangzhou Asian Games"

current

Integer

No

Current page number

Default value: 1

1

size

Integer

No

Number of entries to return per page

Default value: 20

20

includeContent

Boolean

No

Specifies whether to return the article body

Default value: true

true

Response specifications

Response headers

Content-Type: application/json

Response body

The response body is in the application/json format. Its structure is as follows:

Field name

Field type

Description

Example value

success

Boolean

Indicates whether the request is successful

true

code

String

Error code returned when the request fails

"PARAM_ERROR"

message

String

Error message returned when the request fails

"Parameter error"

data

List

List of search result data. For the specific structure, see the Article object below

[]

current

Integer

Current page number

1

size

Integer

Number of entries returned per page

20

total

Integer

Total number of matched entries

100

Article object

The data field of the response body is a list, and each element in the list is an Article object. Its structure is as follows:

Field name

Field type

Required

Description

Example value

source

String

Yes

Article source

"CCTV.com"

title

String

Yes

Article title

"Hangzhou Asian Games"

content

String

Yes

Article body. If the request parameter includeContent is false, an empty string can be returned.

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

url

String

Yes

Original URL of the article

"http://news.cctv.com/..."

summary

String

No

Article summary. If the original data does not contain this field, you can use the first N characters of the article body as the summary.

"Summary content..."

pubTime

String

Yes

Article publication time, in the format: yyyy-MM-dd HH:mm:ss

"2023-01-01 12:01:01"

Examples

Request

curl -X POST --location '{{url}}' \
-H 'Authorization: basic {{BasicToken}}' \
-H 'Content-Type: application/json' \
-d '{
      "query": "杭州亚运会"
    }'

Response

{
  "success": true,
  "code": "",
  "message": "",
  "data": [{
    "source": "央视网",
    "title": "杭州亚运会",
    "content": "无论是“大莲花”“小莲花”“大玉琮”“杭州伞”等场馆造型",
    "url": "http://news.cctv.com/2023/08/29/ARTIZeHbELfOWLgviHk1IxGb230829.shtml",
    "summary": "摘要",
    "pubTime": "2023-01-01 12:01:01"
  }],
  "current": 1,
  "size": 20,
  "total": 100
}