Updated on 2023-09-27 GMT+08:00

POST /CCSQM/rest/ccisqm/v1/sentencemanage/querySentence

Scenario

This interface is invoked to query sentences. If the input parameter contains the unique ID of a sentence, details about the sentence are queried. Otherwise, a sentence list is queried.

Method

POST

URI

https://Domain name/apiaccess/CCSQM/rest/ccisqm/v1/sentencemanage/querySentence (For example, the domain name is service.besclouds.com.)

Request Description

Table 1 Request header parameters

No.

Parameter

Type

Mandatory or Not

Description

1

Content-Type

String

No

The value is fixed to application/json; charset=UTF-8.

2

x-app-key

String

No

App key

3

Authorization

String

Yes

Authentication field. The format is Bearer {Value of AccessToken returned by the tokenByAkSk interface}. (A space is required after Bearer.)

4

x-UserId

String

No

Operator ID

You can sign in to the system and go to the employee management page to view the value of userId returned by an interface.

Table 2 Request body parameters

No.

Parameter

Type

Mandatory or Not

Description

1.1

category_id

String

No

Unique ID of a sentence category. If the ID of a sentence category is transferred, only sentences in the category are queried.

1.2

page

Number

Yes

Page number. Pagination query criterion.

1.3

limit

Number

Yes

Number of records on each page. Pagination query criterion.

  • Value range: 5, 10, 20, 50, and 100

1.4

keyword

String

No

Query keyword

1.5

sentence_id

String

No

Unique ID of a sentence. If the ID of a sentence is transferred, only details about the sentence are returned.

Response Description

  • Status code: 200
Table 3 Response body parameters

No.

Parameter

Type

Mandatory or Not

Description

1.1

data

Array [Object]

No

Returned sentence dataset

1.1.1

category_id

String

No

Unique ID of a sentence category

1.1.2

sentence_id

String

Yes

Unique ID of a sentence

1.1.3

sentence_name

String

No

Sentence name

1.1.4

tags

Array [Object]

No

Semantics and keywords used in a sentence

1.1.4.1

tag_id

String

No

Unique ID of a tag

1.1.4.2

tag_name

String

No

Tag name

1.1.4.3

tag_type

String

No

Tag type. The options are keyword (keyword), dialogue_act (semantic), and regular_exp (regular expression).

1.2

paging

Object

No

Pagination information

1.2.1

current

Number

No

Page number

1.2.2

limit

Number

No

Number of records on each page

1.2.3

total

Number

No

Total number of query results

1.3

category_id

String

No

Unique ID of a category

1.4

sentence_id

String

No

Unique ID of a sentence

1.5

sentence_name

String

No

Sentence name

1.6

tagDataList

Array [Object]

No

List of semantics and keywords

1.6.1

tag_type

String

No

Tag type

1.6.2

pos_sentences

Array [Object]

No

Positive semantics, keywords, and regular expressions

1.6.2.1

id

String

No

Unique ID of a corpus

1.6.2.2

name

String

No

Corpus content

1.6.3

neg_sentences

Array [Object]

No

Negative semantics, which cannot coexist with pos_sentences in one tag object

1.6.3.1

id

String

No

Unique ID of a corpus

1.6.3.2

name

String

No

Corpus content

1.7

resultCode

String

No

Return code

  • 0403000: success
  • Others: failure

1.8

resultDesc

String

No

Return description

  • Status code: 400

    Incorrect request. Check the request path and parameters.

  • Status code: 401

    Unauthorized operation. 1. Check whether you have purchased related services. 2. Contact customer service to check the status of your account.

  • Status code: 404

    The requested content is not found. Check the request path.

  • Status code: 500

    Business failure. Check the values of parameters in the request.

Error Codes

None

Example

  • Scenario 1: Query a sentence list.

    Request header:

    x-app-key:************************************  
    X-UserID:1611917095665261978  
    Authorization:Bearer ********************************

    Request parameters:

    {
        "category_id": "1070149256381206528",
        "keyword": "Sentence",
        "page": 1,
        "limit": 10
    }

    Response parameters:

    {
      "paging": {
        "total": 4
      },
      "data": [
        {
          "category_id": "1070149256381206528",
          "sentence_id": "10870",
          "sentence_name": "Sentence name 78",
          "tags": null
        },
        {
          "category_id": "1070149256381206528",
          "sentence_id": "10877",
          "sentence_name": "Sentence name 25",
          "tags": null
        },
        {
          "category_id": "1070149256381206528",
          "sentence_id": "10884",
          "sentence_name": "Sentence name 39",
          "tags": null
        },
        {
          "category_id": "1070149256381206528",
          "sentence_id": "10891",
          "sentence_name": "Sentence name 85",
          "tags": null
        }
      ]
    }
    • Scenario 2: Query sentence details by sentence ID.

      Request header:

      x-app-key:************************************  
      X-UserID:1611917095665261978  
      Authorization:Bearer ********************************

      Request parameters:

      {
          "sentence_id": "10891"
      }

      Response parameters:

      {
        "category_id": "1070149256381206528",
        "sentence_id": "10891",
        "tagDataList": [
          {
            "tag_type": "dialogue_act",
            "pos_sentences": [
              {
                "name": "Synonym corpus 18",
                "id": "10169"
              }
            ],
            "neg_sentences": [
              {
                "name": "Antonym corpus 14",
                "id": "10047"
              }
            ]
          },
          {
            "tag_type": "keyword",
            "pos_sentences": [
              {
                "name": "Regular expression 2221",
                "id": "10109"
              },
              {
                "name": "Keyword 22223",
                "id": "10108"
              },
              {
                "name": "Keyword 11164",
                "id": "10107"
              }
            ]
          }
        ],
        "sentence_name": "Sentence name 85",
        "resultCode": "0403000",
        "resultDesc": "Operation successful."
      }