Help Center> ServiceStage> API Reference> ServiceComb API> Microservice> Deleting Definition Information About a Microservice
Updated on 2024-06-14 GMT+08:00

Deleting Definition Information About a Microservice

Function

This API is used to delete definition and related information about a microservice, and deregister all instances of the microservice.

Restrictions

None

URI

DELETE /v4/{project_id}/registry/microservices/{service_id}

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

  • For a professional microservice engine, enter the tenant project ID. The value contains 1 to 64 characters. See Obtaining a Project ID. You can also enter the fixed value default.
  • For an exclusive microservice engine, enter the fixed value default.

service_id

Yes

String

Microservice ID, which must be unique. The value contains 1 to 64 characters. Regular expression: ^.*$. See Querying Information About All Microservices.

Table 2 Query parameter

Parameter

Mandatory

Type

Description

force

No

Boolean

Whether to forcibly delete information about a microservice.

true: forcible deletion; false: non-forcible deletion.

If you choose forcible deletion, all service instances are automatically deregistered and related service dependencies are deleted. If this parameter is not transferred, the service cannot be deleted when it has an instance.

Default value: false.

Request

Table 3 Request header parameter

Parameter

Mandatory

Type

Description

Authorization

No

String

This parameter is mandatory if security authentication is enabled for an exclusive microservice engine. Otherwise, this parameter is not required.

The token of an exclusive microservice engine with security authentication enabled is in the following format:

Authorization:Bearer {Token}

For details about how to obtain the token, see Obtaining the User Token of an Exclusive Microservice Engine.

Response

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

errorCode

String

Error code.

errorMessage

String

Error message.

detail

String

Location details.

Status code: 500

Table 5 Response body parameters

Parameter

Type

Description

errorCode

String

Error code.

errorMessage

String

Error message.

detail

String

Location details.

Example Request

Delete the microservice whose ID is e0f0da073f2c91e8979a89ff2d7c69t6.

DELETE https://{endpoint}/v4/d9f4da085f2c11e8959a00ff2d7c69b7/registry/microservices/e0f0da073f2c91e8979a89ff2d7c69t6

Example Response

None

Status Code

Status Code

Description

200

OK

400

Bad Request

500

Internal Server Error

Error Code

See ServiceComb Error Codes.