兩邊的前次修訂版 前次修改
下次修改 | 前次修改
|
tech:alpine_semaphore:api [2024/01/02 19:33] – 2. Generate an API token jonathan | tech:alpine_semaphore:api [2024/01/02 19:45] (目前版本) – [5. Get template] jonathan |
---|
API token 就是所回傳的 id 值 : p5wyfpx9wge4wu57ytfkx9msmu0efke6yqvzapfd3hg= | API token 就是所回傳的 id 值 : p5wyfpx9wge4wu57ytfkx9msmu0efke6yqvzapfd3hg= |
</cli>++ | </cli>++ |
| |
| ==== 3. Remove task ==== |
| * 需要使用到 API token : p5wyfpx9wge4wu57ytfkx9msmu0efke6yqvzapfd3hg= |
| * 預計刪除 task : 18 |
| * <cli> |
| curl -v -X 'DELETE' 'http://localhost:3000/api/project/1/tasks/18' -H 'accept: application/json' -H 'Authorization: Bearer p5wyfpx9wge4wu57ytfkx9msmu0efke6yqvzapfd3hg=' |
| </cli> |
| * ++實際操作畫面|<cli> |
| semaphore-44:~/cli-work# curl -v -X 'DELETE' 'http://localhost:3000/api/project/1/tasks/18' -H 'accept: application/json' -H 'Authorization: Bearer p5wyfpx9wge4wu57ytfkx9msmu0efke6yqvzapfd3hg=' |
| * Host localhost:3000 was resolved. |
| * IPv6: ::1 |
| * IPv4: 127.0.0.1 |
| * Trying [::1]:3000... |
| * Connected to localhost (::1) port 3000 |
| > DELETE /api/project/1/tasks/18 HTTP/1.1 |
| > Host: localhost:3000 |
| > User-Agent: curl/8.5.0 |
| > accept: application/json |
| > Authorization: Bearer p5wyfpx9wge4wu57ytfkx9msmu0efke6yqvzapfd3hg= |
| > |
| < HTTP/1.1 204 No Content |
| < Content-Type: application/json |
| < Date: Tue, 02 Jan 2024 11:36:34 GMT |
| < |
| * Connection #0 to host localhost left intact |
| </cli>++ |
| |
| ==== 4. Remove template ==== |
| * 需要使用到 API token : p5wyfpx9wge4wu57ytfkx9msmu0efke6yqvzapfd3hg= |
| * 預計刪除 template : 1 |
| * 屬於這 template 的所有 task 都會一併刪除 |
| * <cli> |
| curl -X 'DELETE' 'http://localhost:3000/api/project/1/templates/1' -H 'accept: application/json' -H 'Authorization: Bearer p5wyfpx9wge4wu57ytfkx9msmu0efke6yqvzapfd3hg=' |
| </cli> |
| * ++實際操作畫面|<cli> |
| semaphore-44:~/cli-work# curl -X 'DELETE' 'http://localhost:3000/api/project/1/templates/1' -H 'accept: application/json' -H 'Authorization: Bearer p5wyfpx9wge4wu57ytfkx9msmu0efke6yqvzapfd3hg=' |
| </cli>++ |
| |
| ==== 5. Get template ==== |
| * 需要使用到 API token : p5wyfpx9wge4wu57ytfkx9msmu0efke6yqvzapfd3hg= |
| * 預計取得 template : 2 |
| * <cli> |
| curl -X 'GET' 'http://localhost:3000/api/project/1/templates/2' -H 'accept: application/json' -H 'Authorization: Bearer p5wyfpx9wge4wu57ytfkx9msmu0efke6yqvzapfd3hg=' |
| </cli> |
| * ++實際操作畫面|<cli> |
| semaphore-44:~/cli-work# curl -X 'GET' 'http://localhost:3000/api/project/1/templates/2' -H 'accept: application/json' -H 'Authorization: Bearer p5wyfpx9wge4wu57ytfkx9msmu0efke6yqvzapfd3hg=' |
| { |
| "id": 2, |
| "project_id": 1, |
| "inventory_id": 2, |
| "repository_id": 1, |
| "environment_id": 1, |
| "name": "daliy-update-ubuntu", |
| "playbook": "upgrade.yml", |
| "arguments": null, |
| "allow_override_args_in_task": false, |
| "description": null, |
| "vault_key_id": null, |
| "type": "", |
| "start_version": null, |
| "build_template_id": null, |
| "view_id": 1, |
| "last_task": { |
| "id": 28, |
| "template_id": 2, |
| "project_id": 1, |
| "status": "success", |
| "debug": false, |
| "dry_run": false, |
| "diff": false, |
| "playbook": "", |
| "environment": "", |
| "limit": "", |
| "user_id": null, |
| "created": "2024-01-02T10:35:00.001752Z", |
| "start": "2024-01-02T10:35:03.218576Z", |
| "end": "2024-01-02T10:35:32.726596Z", |
| "message": "", |
| "commit_hash": null, |
| "commit_message": "", |
| "build_task_id": null, |
| "version": null, |
| "arguments": null, |
| "tpl_playbook": "upgrade.yml", |
| "tpl_alias": "daliy-update-ubuntu", |
| "tpl_type": "", |
| "user_name": null, |
| "build_task": null |
| }, |
| "autorun": false, |
| "survey_vars": null, |
| "suppress_success_alerts": false |
| } |
| </cli>++ |
| |
| |
| |
{{tag>ansible semaphore}} | {{tag>ansible semaphore}} |
| |