compute
POST /v1/compute/servers/{serverId}/services/action
Start, stop or restart one service inside a server.
ការផ្ទៀងផ្ទាត់ភាពត្រឹមត្រូវ
បញ្ជូនសោ API ជា bearer token។ សោនេះត្រូវតែមានសិទ្ធិ sites.view។ សោដែលគ្មានសិទ្ធិនេះនឹងត្រូវបដិសេធដោយកូដ 403 មិនមែន 404 ទេ។
ចំនុចបញ្ចប់នេះមិនត្រូវការលេខសម្គាល់ស្ថាប័នទេ។ ពស័្ដកូនរបស់អ្នករួចហើយកំណត់អត្តសញ្ញាណស្ថាប័នដែលវាជាកម្មសិទ្ធិ ហើយការឆ្លើយតបគឺត្រូវបានកំណត់វិសាលភាពទៅតាមនោះ។
សាកល្បង
ជំនួសអ្វីមួយនៅក្នុងសញ្ញាពងក្រពើ < > ដោយប្រើតម្លៃផ្ទាល់ខ្លួនរបស់អ្នក ហើយជំនួសកន្លែងរក្សាទុកសោដោយប្រើសោចេញពីផ្ទាំងគ្រប់គ្រងរបស់អ្នក។
curl -X POST https://api.zinndigital.com/v1/compute/servers/{serverId}/services/action \
-H "Authorization: Bearer zdk_live_…" \
-H "Content-Type: application/json" \
-d '{ "unit": <string>, "action": <string<start, stop, restart>> }'បានចូលគណនីរួចហើយមែនទេ? កុងសូល API ក្នុងផ្ទាំងគ្រប់គ្រងរបស់អ្នក បំពេញលេខសម្គាល់ស្ថាប័នពិតប្រាកដរបស់អ្នក និងសោផ្ទាល់ខ្លួនរបស់អ្នក ហើយដំណើរការសំណើទល់នឹង API ផ្ទាល់ ដូច្នេះអ្នកអាចមើលឃើញការឆ្លើយតបពិតប្រាកដ។ បើកចំណុចបញ្ចប់នេះក្នុងកុងសូល API
ព័ត៌មានលម្អិត
Acts on a single service unit inside the machine - Apache, MariaDB, ProFTPD - while the machine itself stays up. This is the difference between a customer whose site is down fixing it themselves in ten seconds and a customer opening a ticket. ⛔ **Not the same blast radius as `setComputeServerPower`.** That one moves the whole machine; this moves one unit inside a machine that keeps running. Stopping a web server or a database still takes every website on that box off the air, so the operation is audit-logged with the real actor. ⛔ **`unit` must be a service the machine is currently running.** The engine checks the name against the machine's own live service list before sending anything, so an arbitrary systemd unit - `sshd.service`, a firewall, the enrolment agent - is refused with a `422` that names what is available instead. The list this endpoint's sibling `listComputeServerServices` returns is exactly the set that may be named here. The response carries the provider's own confirmation sentence, which is worth showing to the customer verbatim. `404` for a server that is not the caller's; `422` for a machine that is not `active`, a unit it does not run, or a verb outside start/stop/restart. Requires `sites.view` **and** `sites.restart`.
ប៉ារ៉ាម៉ែត្រ
| ឈ្មោះ | ប្រភេទ | តម្រូវការ | តើវាជាអ្វី |
|---|---|---|---|
serverId (path) | Uuid | បាទ/ចាស | The server's id, as `listComputeServers` reports it. **Ours** (UUIDv7), minted when the order row was written — never the provider's own identifier for the machine. |
សំណើរបស់រាងកាយ
| ឈ្មោះ | ប្រភេទ | តម្រូវការ | តើវាជាអ្វី |
|---|---|---|---|
unit | string | បាទ/ចាស | The service unit to act on, exactly as `listComputeServerServices` reports it (`httpd.service`, `mariadb.service`, `proftpd.service`). ⛔ Must be a unit the machine is **currentl… |
action | string<start, stop, restart> | បាទ/ចាស | ⛔ A closed vocabulary. `reload`, `enable` and `disable` are deliberately absent: they have never been proven against a provider, and a verb we have not proven is a button that m… |
ផ្អាកដំណើរការ
| ឈ្មោះ | ប្រភេទ | តម្រូវការ | តើវាជាអ្វី |
|---|---|---|---|
message | string | បាទ/ចាស | The provider's own confirmation sentence — *"Service proftpd.service was stopped successfully."* — passed through verbatim, because it is more specific than anything we would su… |
កំហុសដែលចំណុចបញ្ចប់នេះអាចបង្វិលត្រឡប់មកវិញ
401 · 403 · 404 · 422 · 429 · 503