Skip to content

Api Invoke Examples

Common

1. response structure

All responses have a common structure like below:

json
{
  "code": 0,
  "message": "success",
  "data": data
}
NameTypeDescription
codeinteger0: success, other: fail
dataobjectdata
messagestringerror message

2. pagination structure

When querying a list of records, you will get a response with pagination records. Response structure with pagination like below:

json
{
  "code": 0,
  "message": "success",
  "data": {
    "records": [
      {},
      {}
    ],
    "total": 2,
    "size": 10,
    "current": 1,
    "pages": 1
  }
}
NameTypeDescription
recordsarrayquery result records
totalintegertotal number of records
sizeintegerpage size
currentintegercurrent page
pagesintegertotal number of pages

Get examples

1. document

Request path

http
GET /v2/label/list

Request parameters

NameTypeRequiredDescriptionExample
qstringfalseSearch condition
currentintegerfalsePage number1
sizeintegerfalseNumber of items per page10
labelCodestringfalseLabel code
labelNamestringfalseLabel name
labelStatusintegerfalseLabel status

2. invoke api

http
GET https://server.workstem.com/api/v2/label/list?q=01&current=1&size=10

TIP

Empty parameters do not need to be passed.

Post examples

1. document

Request path

http
POST /v2/label/update

Request parameters

NameTypeRequiredDescription
idstringtrueID
labelCodestringfalseLabel code
labelNamestringfalseLabel name
labelStatusintegerfalseLabel status

2. invoke api

http
POST https://server.workstem.com/api/v2/label/update
{
	"id":"001",
	"labelCode":"C001"
}

TIP

Empty parameters do not need to be passed.