{"id":20452762,"url":"https://github.com/tinuwalther/psautomic","last_synced_at":"2026-05-28T13:02:21.754Z","repository":{"id":232594117,"uuid":"624786606","full_name":"tinuwalther/PSAutoMic","owner":"tinuwalther","description":"Example with Pode Rest APIs","archived":false,"fork":false,"pushed_at":"2024-07-13T14:52:18.000Z","size":98488,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-15T23:12:19.541Z","etag":null,"topics":["api","pode","powershell","pwsh"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tinuwalther.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-07T08:55:51.000Z","updated_at":"2024-07-13T14:52:21.000Z","dependencies_parsed_at":"2024-04-17T11:29:56.643Z","dependency_job_id":"907f3c6c-7f59-40f7-b4d6-355f27332101","html_url":"https://github.com/tinuwalther/PSAutoMic","commit_stats":null,"previous_names":["tinuwalther/psautomic"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinuwalther%2FPSAutoMic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinuwalther%2FPSAutoMic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinuwalther%2FPSAutoMic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinuwalther%2FPSAutoMic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tinuwalther","download_url":"https://codeload.github.com/tinuwalther/PSAutoMic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242005693,"owners_count":20056430,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","pode","powershell","pwsh"],"created_at":"2024-11-15T11:10:16.473Z","updated_at":"2026-05-28T13:02:16.706Z","avatar_url":"https://github.com/tinuwalther.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PowerShell RestAPI\n\nExample with Pode Rest APIs. In this example I demostrate how you can create and delete a Docker Image and Container over RestAPI.\n\n````mermaid\nsequenceDiagram\n    Postman-\u003e\u003eRestAPI: invoke request\n    RestAPI-\u003e\u003eFileWatcher: queue result\n    RestAPI-\u003e\u003eFileWatcher: queue result\n    FileWatcher-\u003e\u003eDocker: new docker container\n    FileWatcher-\u003e\u003eDocker: del docker container\n    FileWatcher-\u003e\u003eDocker: new docker container\n````\n\n## Requirements\n\nThis example require the following PowerShell Modules:\n\n- Microsoft.PowerShell.SecretManagement\n- SecretManagement.KeePass\n- Pode\n\nYou need also to install Docker Desktop and KeePass on your computer.\n\n## Configure KeePass\n\nCreate a KeePassDB with the name 'PSOctomes' on your computer and define an Entry with a Username and Password for the Bearer Token that you can access the RestAPI.  \nModify the script Config-Secrets.ps1 and enter the path to your KeePass-File.  \nExecute the script Config-Secrets.ps1.\n\n## Start Pode RestAPI\n\nOpen a PowerShell or Terminal and start the Pode server. If you send the Request the first one, you have to enter the KeePass Master Password.\n\n````powershell\n.\\PSAutoMic\\bin\\Start-PSAutoMic.ps1\n\nRunning Pode server on D:\\DevOps\\github.com\\PSAutoMic\\bin\nPress Ctrl. + C to terminate the Pode server\nListening on the following 1 endpoint(s) [2 thread(s)]:\n        - http://localhost:8080/\n\nKeepass Master Password\nEnter the Keepass Master password for: C:\\Users\\Admin\\OneDrive\\Do*ument*\\PSOctomes.kdbx\nPassword for user Keepass Master Password: ********\n````\n\n![Start-RestAPI](./img/Start-RestAPI.png)\n\n## Request a Linux over PowerShell\n\nCurrent available Kernel:\n\n- Almalinux\n- Ubuntu\n- Photon OS\n\nRequest your first almalinux over RestAPI. The owner is also the logged-in user and is member of sudoers.\n\n````powershell\n$BearerToken = \"\"\n$headers = @{\n    'Content-Type'  = 'application/json'\n    'Authorization' = \"Bearer $BearerToken\"\n}\n\n$body = @{\n    hostname  = 'almalnx'\n    os        = 'almalinux'\n    version   = '9'\n    imagename = 'almal_image'\n    container = 'almal_container'\n    action    = 'create'\n    owner     = 'tinu'\n    scout     = $false\n    pass      = 'T0pS£creT!'\n} | ConvertTo-Json -Compress\n\n$Properties = @{\n    Method  = 'POST'\n    Headers = $headers\n    Uri     = \"http://localhost:8080/api/v1/docker\"\n    Body    = $body\n}\n$response = Invoke-RestMethod @Properties\n````\n\nAlmalinux is created:\n\n![Created-Almalinux](./img/Created-Almalinux.png)\n\n## Remove a Linux over PowerShell\n\nRemove your almalinux over RestAPI.\n\n````powershell\n$BearerToken = \"\"\n$headers = @{\n    'Content-Type'  = 'application/json'\n    'Authorization' = \"Bearer $BearerToken\"\n}\n\n$body = @{\n    os        = 'almalinux'\n    imagename = 'almal_image'\n    container = 'almal_container'\n    action    = 'delete'\n} | ConvertTo-Json -Compress\n\n$Properties = @{\n    Method  = 'POST'\n    Headers = $headers\n    Uri     = \"http://localhost:8080/api/v1/docker\"\n    Body    = $body\n}\n$response = Invoke-RestMethod @Properties\n````\n\n## Request a Linux over Postman\n\nSend a RestAPI call to create a ubuntu over Postman:\n\n![Request-Ubuntu](./img/Request-Ubuntu.png)\n\nUbuntu is created:\n\n![Created-Ubuntu](./img/Created-Ubuntu.png)\n\nDocker containers:\n\n![Docker-Containers](./img/Docker-Containers.png)\n\n## Request a Linux over Bruno\n\nSend a RestAPI call to create an Almalinux over Bruno:\n\n![Request-Almalinux](./img/RestAPI-Almalinux.png)\n\nAlmalinux is created:\n\n![Created-Almalinux](./img/Created-Almalinux2.png)\n\n![Created-Almalinux](./img/Created-Almalinux1.png)\n\n## Start a container interactive\n\nTo start a container, that already exists:\n\n````powershell\ndocker start photon_container -i\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinuwalther%2Fpsautomic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinuwalther%2Fpsautomic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinuwalther%2Fpsautomic/lists"}