Help Center/ ModelArts/ API Reference/ Service Management/ Updating the Service Through the Patch Operation
Updated on 2024-05-30 GMT+08:00

Updating the Service Through the Patch Operation

Function

This API is used to update the service through the patch operation. For details about the patch format, see json patch.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

PATCH /v1/{project_id}/services/{service_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID and Name.

service_id

Yes

String

Service ID

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-ModelArts-User-ID

No

String

User ID required for using the agency token to verify the workspace

X-Auth-Token

Yes

String

User token

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

[items]

Yes

Array of PatchServiceV2RequestBody objects

Request body in the JSON patch format. Currently, the path can only be prefixed with /config, that is, only model data can be modified.

Table 4 PatchServiceV2RequestBody

Parameter

Mandatory

Type

Description

op

No

String

Operation type. Currently, only replace is supported.

path

No

String

Operation path. The prefix is fixed at /config/0/.

value

No

String

Modified value

Response Parameters

Status code: 200

Table 5 Response header parameters

Parameter

Type

Description

X-Request-Id

String

Request link ID, which can be used for log tracing

Table 6 Response body parameters

Parameter

Type

Description

update_time

String

Update time. This parameter is returned only when the service configuration upgrade is triggered. For example, if the config parameter is modified, the update result can be filtered from the service update records based on this time. This parameter is not returned when the description is modified or the service is started or stopped.

resource_ids

String

Updated resource IDs.

Status code: 400

Table 7 Response header parameters

Parameter

Type

Description

X-Request-Id

String

Request link ID, which can be used for log tracing

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error codes of ModelArts.

error_msg

String

Error message.

Example Requests

Update the service through the patch operation.

PATCH https://{endpoint}/v1/{project_id}/services/{service_id}

[ {
  "op" : "replace",
  "path" : "/config/0/envs",
  "value" : { }
}, {
  "op" : "replace",
  "path" : "/config/0/model_id",
  "value" : "a9542b46-8dfd-4184-bd81-c8d8946edb47"
}, {
  "op" : "replace",
  "path" : "/config/0/additional_properties",
  "value" : {
    "persistent_volumes" : [ {
      "storage_type" : "obs_pfs",
      "source_address" : "/dongcong4",
      "mount_path" : "/var/tmp",
      "storage_type_text" : "atelier_webservice_detail_model_config_volumes_type_obs"
    } ]
  }
}, {
  "op" : "replace",
  "path" : "/config/0/specification",
  "value" : "modelarts.vm.ai1.a310"
}, {
  "op" : "replace",
  "path" : "/config/0/pool_name",
  "value" : "pool-c8e2-04f258c84780d5a52f3bc00dc15aa5e7"
} ]

Example Responses

Status code: 200

OK

{
  "update_time" : 1700625410586,
  "resource_ids" : [ "INF-ae2aa85ce2a3fcac-1700530937033", "INF-ae2aa85ca9542b46-1700530937026" ]
}

Status Codes

Status Code

Description

200

OK

400

Invalid parameter

Error Codes

See Error Codes.