Help Center/ ServiceStage/ API Reference (ME-Abu Dhabi Region)/ CSE API/ Creating Static Information for a Microservice
Updated on 2023-06-25 GMT+08:00

Creating Static Information for a Microservice

Function

This API is used to create static information for a microservice before registering a microservice instance. The registered instance is associated with the static information based on the serviceId field. One service corresponds to multiple instances.

The serviceId field can be customized. If serviceId is not customized, the system generates a random service ID.

URI

POST /v4/{project_id}/registry/microservices

Table 1 Path parameters

Parameter

Type

Mandatory

Description

project_id

String

Yes

Fixed value: default.

Request

Table 2 Request body parameters

Parameter

Type

Mandatory

Description

service

Object

Yes

Microservice struct. For details, see MicroService.

rules

Array of objects

No

Blacklist and whitelist structs. For details, see Rule.

instances

Array of objects

No

Microservice instance struct. For details, see MicroServiceInstance.

tags

Map<String, String>

No

Microservice tag. You can customize a key and value.

Response

Response parameters

Table 3 describes the parameters.

Table 3 Parameter

Parameter

Type

Description

serviceId

String

Microservice ID, which must be unique.

Example

Example request

{
  "service": {
    "serviceId": "string",
    "environment": "string",
    "appId": "string",
    "serviceName": "string",
    "version": "string",
    "description": "string",
    "level": "string",
    "registerBy": "string",
    "schemas": [
      "string"
    ],
    "status": "UP",
    "timestamp": "string",
    "modTimestamp": "string",
    "framework": {
      "name": "string",
      "version": "string"
    },
    "paths": [
      {
        "Path": "string",
        "Property": {
          "additionalProp1": "string",
          "additionalProp2": "string",
          "additionalProp3": "string"
        }
      }
    ]
  },
  "rules": [
    {
      "ruleId": "string",
      "ruleType": "string",
      "attribute": "string",
      "pattern": "string",
      "description": "string",
      "timestamp": "string",
      "modTimestamp": "string"
    }
  ],
  "instances": [
    {
      "instanceId": "string",
      "serviceId": "string",
      "version": "string",
      "hostName": "string",
      "endpoints": [
        "string"
      ],
      "status": "string",
      "healthCheck": {
        "mode": "string",
        "port": 0,
        "interval": 0,
        "times": 0
      },
      "dataCenterInfo": {
        "name": "string",
        "region": "string",
        "availableZone": "string"
      },
      "timestamp": "string",
      "modTimestamp": "string"
    }
  ],
  "tags": {
    "additionalProp1": "string",
    "additionalProp2": "string",
    "additionalProp3": "string"
  }
}

Example response

{
  "serviceId": "string"
}

Status Code

See Status Codes.

Error Code

See CSE Error Codes.