Very curious about the c# API, as I’ve been meaning to expand beyond Powershell. Any plans to make a video about it using this? Maybe a demo of an API written in Powershell that you then convert to c#?
You may have seen the docs here but the API included is actually a functional one that can get and restart dashboards.
Honestly, one shortcoming of this feature is that there isn’t any documentation of the actual PSU classes that you have access to so unless you feel like digging around with ILSpy, it might be hard to get something meaningful accomplished. That said, I’d love to hear some ideas for what you’d like to accomplish and I’d be happy to code up some examples.
For what I do in my environment, SQL CRUD and processing files (mostly just ingesting the JSON, dumping to a folder for a job to run later) would be great.
I’m definitely someone who “learns by doing”, but tends to need good solid examples to pick apart and figure out how it all comes together, which is why I like Powershell so much. I can take code and run it line by line and examine the outputs…
C# seems a bit daunting in that aspect, as it needs compiled and ran. At least to my knowledge I can’t just “run” pieces of it.
@adam Are there plans for more documentation in the nearish future? We are very interested in utilizing the c# endpoints for basic crud / EF functionality. As you said in the plugins documentation nothing is really documented so it’s been a bit tough to really experiment… The documentation for the experimental feature has a little more but about the same. Many things just fail and we are flying a little blind. We can at least gather that the IDatabase interface is PowerShellUniversal.SQL.Database… but… that’s as far as we have gotten…
We are primarily looking for:
an example of taking in query params or a body. Not sure how some of the apirequest parameters match up with asp.net
using IDatabase to read / write, preferably to another database than what PSU uses.
Any information about the environment itself. Is it possible to import libraries? What’s context is a c# endpoint run in?
Are there compile time logs anywhere if there are errors?
I believe PSU is using EF behind the scenes? Would that be available or would we want to look at using something like Microsoft.Data.Sqlclient?
Really, looking for anything… or if anyone has successfully used a c# endpoint for basic CRUD stuff and can point me in that direction that would be awesome.