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}
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
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 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
[items] |
Yes |
Array of PatchServiceV2RequestBody objects |
Request body of the service PATCH operation |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
op |
No |
String |
Operation type. Currently, only replace is supported, indicating the value replacement operation. |
path |
No |
String |
Operation path, which complies with the standard JSON PATCH format. It indicates the target path (JSON PATH) of the value to be replaced based on the JSON response body of the service details. Currently, only model-related parameters can be replaced and updated. Therefore, the prefix is fixed to /config/. For example, if you want to update the number of instances in the first model, the path is /config/0/instance_count. |
value |
No |
String |
Target value for replacement. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
X-Request-Id |
String |
Request link ID, which can be used for log tracing |
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
Parameter |
Type |
Description |
---|---|---|
X-Request-Id |
String |
Request link ID, which can be used for log tracing |
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Range: N/A |
error_msg |
String |
Definition: Error message. Range: N/A |
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot