差異處
這裏顯示兩個版本的差異處。
| 下次修改 | 前次修改 | ||
| tech:alpine_semaphore:api [2024/01/02 17:35] – 建立 jonathan | tech:alpine_semaphore:api [2024/01/02 19:45] (目前版本) – [5. Get template] jonathan | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| - | ====== Ansible Semaphore API 整理 ====== | + | ====== Ansible Semaphore API 手動執行整理 ====== |
| * API Swagger - https:// | * API Swagger - https:// | ||
| 行 46: | 行 46: | ||
| -rw-r--r-- | -rw-r--r-- | ||
| </ | </ | ||
| + | |||
| + | ==== 2. Generate an API token ==== | ||
| + | * 需要使用到 cookie 檔 ./ | ||
| + | * <cli> | ||
| + | curl -v -b ./ | ||
| + | -H ' | ||
| + | -H ' | ||
| + | http:// | ||
| + | </ | ||
| + | * ++實際操作畫面|< | ||
| + | semaphore-44: | ||
| + | > -H ' | ||
| + | > -H ' | ||
| + | > http:// | ||
| + | * Host localhost: | ||
| + | * IPv6: ::1 | ||
| + | * IPv4: 127.0.0.1 | ||
| + | * | ||
| + | * Connected to localhost (::1) port 3000 | ||
| + | > POST / | ||
| + | > Host: localhost: | ||
| + | > User-Agent: curl/8.5.0 | ||
| + | > Cookie: semaphore=MTcwNDE4NzkwOXw2UlByZHVXdkhIMU5wN2ROZTg1VGdvOEp5SGpXTGpqZEMzM3pIcjNUVmVpQ0ZOb0JwdjBHYmlwLWlsRnpDNDF5MlVSd1ZXdlB4N3k5Y3RFbzhhSlVGUWs9fIEdaH9kKEep32Acl8S5j3WF_LHbfojgVQPs_oJMu9Cw | ||
| + | > Content-Type: | ||
| + | > Accept: application/ | ||
| + | > | ||
| + | < HTTP/1.1 201 Created | ||
| + | < Content-Type: | ||
| + | < Date: Tue, 02 Jan 2024 11:31:12 GMT | ||
| + | < Content-Length: | ||
| + | < | ||
| + | {" | ||
| + | * Connection #0 to host localhost left intact | ||
| + | |||
| + | API token 就是所回傳的 id 值 : p5wyfpx9wge4wu57ytfkx9msmu0efke6yqvzapfd3hg= | ||
| + | </ | ||
| + | |||
| + | ==== 3. Remove task ==== | ||
| + | * 需要使用到 API token : p5wyfpx9wge4wu57ytfkx9msmu0efke6yqvzapfd3hg= | ||
| + | * 預計刪除 task : 18 | ||
| + | * <cli> | ||
| + | curl -v -X ' | ||
| + | </ | ||
| + | * ++實際操作畫面|< | ||
| + | semaphore-44: | ||
| + | * Host localhost: | ||
| + | * IPv6: ::1 | ||
| + | * IPv4: 127.0.0.1 | ||
| + | * | ||
| + | * Connected to localhost (::1) port 3000 | ||
| + | > DELETE / | ||
| + | > Host: localhost: | ||
| + | > User-Agent: curl/8.5.0 | ||
| + | > accept: application/ | ||
| + | > Authorization: | ||
| + | > | ||
| + | < HTTP/1.1 204 No Content | ||
| + | < Content-Type: | ||
| + | < Date: Tue, 02 Jan 2024 11:36:34 GMT | ||
| + | < | ||
| + | * Connection #0 to host localhost left intact | ||
| + | </ | ||
| + | |||
| + | ==== 4. Remove template ==== | ||
| + | * 需要使用到 API token : p5wyfpx9wge4wu57ytfkx9msmu0efke6yqvzapfd3hg= | ||
| + | * 預計刪除 template : 1 | ||
| + | * 屬於這 template 的所有 task 都會一併刪除 | ||
| + | * <cli> | ||
| + | curl -X ' | ||
| + | </ | ||
| + | * ++實際操作畫面|< | ||
| + | semaphore-44: | ||
| + | </ | ||
| + | |||
| + | ==== 5. Get template ==== | ||
| + | * 需要使用到 API token : p5wyfpx9wge4wu57ytfkx9msmu0efke6yqvzapfd3hg= | ||
| + | * 預計取得 template : 2 | ||
| + | * <cli> | ||
| + | curl -X ' | ||
| + | </ | ||
| + | * ++實際操作畫面|< | ||
| + | semaphore-44: | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| {{tag> | {{tag> | ||