Rest API and SQL
Background: I used the API from Cireson to write a script that produces a link where Affected User is available throughout the Portal to see the most recent requests where the selected user is the Affected User. This is giving the first call team and the IT Help Desk some insight over callers that call in multiple times for the same thing, and to make follow up easier.
I like it, but I want to do more. I want to be able to query any type of CI and produce the same results. Computers, servers, printers, etc. Show me the most recent work items where this CI is related.
I started to learn how to leverage Node JS to send a SQL query, and get some data returned. If I run this query:
In SSMS and in my API call, it works just fine. However, I need to make it dynamic so that I'm using a variable for the CI. I've tried to follow an example similar to https://medium.com/voobans-tech-stories/how-to-quickly-create-a-simple-rest-api-for-sql-server-database-7ddb595f751a in order to get the syntax correct, but I'm always getting the 500 server error when I execute. Does anyone have experience with doing something like this? I can provide more detail if anyone needs it.