https://github.com/barrettotte/powershell-crud
A CRUD api written in PowerShell, just because. It has no security and only handles shallow endpoints
https://github.com/barrettotte/powershell-crud
crud-api dotnet mssql powershell web-server
Last synced: 11 months ago
JSON representation
A CRUD api written in PowerShell, just because. It has no security and only handles shallow endpoints
- Host: GitHub
- URL: https://github.com/barrettotte/powershell-crud
- Owner: barrettotte
- Created: 2019-04-11T01:35:43.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-16T00:12:03.000Z (almost 7 years ago)
- Last Synced: 2025-02-03T13:13:19.534Z (about 1 year ago)
- Topics: crud-api, dotnet, mssql, powershell, web-server
- Language: PowerShell
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PowerShell-CRUD
To learn the gist of PowerShell I decided to try making a basic CRUD API.
This CRUD API is configured using ```server.json``` which allows it to use multiple
shallow endpoints via JSON.
You're probably wondering why its all in one script? Its because I am lazy
## Server Output Example
```
Attempting to start server...
Listening on http://127.0.0.1:10024/ ...
GET http://127.0.0.1:10024/api
Status: 200
GET http://127.0.0.1:10024/api/v1/programmers
SELECT * FROM [PowerShell_CRUD].[dbo].[Programmers]
Status: 200
GET http://127.0.0.1:10024/api/v1/programmers/1
SELECT * FROM [PowerShell_CRUD].[dbo].[Programmers] WHERE id='1'
Status: 200
```
## Base API GET Response
```json
{
"title": "Base Endpoint for my PowerShell API",
"description": "For some reason I decided to make an API in PowerShell",
"errors": [],
"data": [
{
"endpoint": "/api/v1/programmers/",
"title": "Programmers Endpoint",
"description": "Get information about a programmer",
"methods": [
"GET",
"PUT",
"POST",
"DELETE"
]
},
{
"endpoint": "/api/v1/products/",
"title": "Products Endpoint",
"description": "Get information about some product",
"methods": [
"GET"
]
}
]
}
```
## /programmers/{id} GET
```json
{
"title": "Programmers Endpoint",
"description": "Get information about a programmer",
"errors": [],
"data": {
"id": 1,
"first_name": "Barrett",
"last_name": "Otte",
"platform": "Linux",
"favorite_language": "Python"
}
}
```
## References
* https://4sysops.com/archives/building-a-web-server-with-powershell
* https://docs.microsoft.com/en-us/powershell/developer/cmdlet/approved-verbs-for-windows-powershell-commands
* https://www.restapitutorial.com/httpstatuscodes.html