HSLHttp::HttpPATCH

I am using Venus to update compounds in our ELN (Signals) as they are changed in Vantage.
I have installed the HSLHttp library and received valid GET and POST responses. However, the request I need to call on the Signals side is a PATCH and I could not find a HSLHttp::HttpPatch option.

Is there a way too call a PATCH request in Venus (or HSL)?

And if not, does anyone know a workaround?

Thanks!

A patch request is the same as a put request that only updates part of a resource’s state. You could try transferring the entire resource state with a put request if that is supported by HSLHttp

Hi Stefan,

Thank you!
There is a GET and a PATCH for this request. The PATCH is not in the same format as the GET response (just tried that) and there is no documentation about updating the entire schema. I’ve tried using POST and PUT methods to send the requests but both respond with 404.

Is there a way to clone a PUT in HSL but just change the PUT to PATCH?
Or is there any other Http req libraries that contain a PATCH?

Thanks!

I dont have the HSLHttp library in front of me but theres a chance it relies on compiled binaries which would make it hard to add extra request types.

Best work around i can think of is having an external program that can make PUT requests and sending data from Venus to that such as via a csv file

My go-to would be using the requests library in Python. You could probably spin something up with ChatGPT very quickly.

1 Like

That was my backup, but would have liked to keep it all local.
OK I’ll see what our IT will let me do!

Thanks!

Looking at the library it seems @WillTurman created HSLHttp - maybe he could advise you on whether the .dll has PATCH functionality that isnt used in the HSL interface…

3 Likes

Decompiling the .dll shows that there isn’t a PATCH function, but you could probably write your own and compile a new version. I’ve attached the PUT function so you can see how its built.


image

1 Like

How do you decompile and recompile like that? Visual Studio?

Thank you Gareth! Super helpful! I might try and be dangerous here to prevent a blind call via shell cURL. Thanks again!

ILSpy

1 Like

If it is a .NET compiled DLL, you can use dotPeek. Its made by JetBrains. ILSpy is another one!

2 Likes

I absolutely stand behind this, it’s a fantastic tool! Depending on the library complexities and dependencies you can sometimes modify the code (you might have to de/reregister depending) to add modifications you might need.

Just be careful as this is definitely out of the scope of device warranties if you are working with any device libraries!

2 Likes

I didn’t include support for the HTTP PATCH method into the HSLHttp library, but only because it was one of the more esoteric HTTP methods and I never had a use case for it.

That said, I haven’t touched that code since I was at Hamilton ~5 years ago and am unsure if it has been updated since then. I imagine some of these tools for working with APIs in Venus are due for some TLC at this point.

2 Likes

Thanks Will,
Great background

Makes sense to me. I agree that PATCH was not a very common verb, especially 5 years ago. It has gained much popularity since then and for the integration I’m using it is required (there is no POST option, server rejects all non-PATCH requests to the URL).

I worked around using Shell to make a cURL PATCH request, but this is indirect and not best practice. I echo that this library is overdue for some upgrading, especially given how common HTTP requesting is with nearly all forms of integration.

Happy to serve as Voice of Customer if needed!
Kyle

Hi all,

Will’s library is now formally maintained by our SW department. If you could prepare a list of functions with needed input/outputs, I can request further development.

Thank you,

Eric

2 Likes

Thanks Eric,

The main thing I need is an additional function (“PATCH”). It would have same input/outputs as the existing “POST” function. A way to set headers, send a body, and receive the response. This is all included and works properly in the “POST” request. I really just need that verb to be sent.