Closed Goghtime closed 1 year ago
Follow-up seems like the issue I'm having is when calling a script like the example provides. Running a command doesn't seem to be an issue.
Can you post your json file and your startup line?
[
{
"RequestType": "GET",
"RequestURL": "/proc",
"RequestCommand": "Get-Process -ProcessName PowerShell -ErrorAction SilentlyContinue | Select-Object -Property ProcessName,Id -ErrorAction SilentlyContinue"
},
{
"RequestType": "GET",
"RequestURL": "/endpoint/status",
"RequestCommand": "return 1"
},
{
"RequestType": "GET",
"RequestURL": "/endpoint/routes",
"RequestCommand": "c:/RestPS/endPoints/GET/Invoke-GetRoutes.ps1"
},
{
"RequestType": "GET",
"RequestURL": "/process",
"RequestCommand": "c:/RestPS/endPoints/GET/Invoke-GetProcess.ps1"
},
{
"RequestType": "GET",
"RequestURL": "/process",
"RequestCommand": "c:/RestPS/endPoints/GET/Invoke-BasicChallenge.ps1"
},
{
"RequestType": "PUT",
"RequestURL": "/Service",
"RequestCommand": "c:/RestPS/endPoints/PUT/Invoke-GetProcess.ps1"
},
{
"RequestType": "POST",
"RequestURL": "/data",
"RequestCommand": "c:/RestPS/endPoints/POST/Invoke-GetProcess.ps1"
},
{
"RequestType": "DELETE",
"RequestURL": "/data",
"RequestCommand": "c:/RestPS/endPoints/DELETE/Invoke-GetProcess.ps1"
}
]
$RestPSparams = @{
RoutesFilePath = 'C:\RestPS\endpoints\RestPSRoutes.json'
Port = '8080'
}
Start-RestPSListener @RestPSparams
I've not changed anything from the standard deployment as of yet - just working through the example.
I think the issue is that there are 2 entries for a 'get' call on the '/process' path.
Remove the 2nd one and see if that works better.
That worked. So simple, sorry about that.
seems like the default 'RestPSRoutes.json has this two entries for get /process.
https://github.com/jpsider/RestPS/blob/master/RestPS/endpoints/RestPSRoutes.json
I also downloaded from the Gallery the following versions, looks like the entry was introduced in 7.0.46 https://www.powershellgallery.com/packages/RestPS/7.0.46/Content/endpoints%5CRestPSRoutes.json
Anyhow - thanks again.
Cool!
I'll update it and push a fix out!
New version was deployed today with the fix.
First off, great project if there is a better place to ask a question as dumb as im about to ask, please direct me to the right place.
I was running through the basic outline you've provided and encounter an issue in the newest couple of versions. I'm not sure what i'm over looking.
currently using the defaults 'RestPSLocalRoot' within C:\RestPS
Invoke-DeployRestPS -LocalDir 'C:\RestPS'
Start your first Endpoint, no problem.
Open a second console as admin. Run the provided input
I get the following error:
What am I over looking, the log file doesn't provide any insight and I tired modifying RestPSroutes.json "RequestCommand" parameter to include an & or a -file without much luck.
Any thoughts?