Forum Discussion

jamiemurphyit's avatar
8 years ago

Ruby - Rest API - Easier signing! Ruby - Windows and Linux compatible

So this is less of an ask the community and more of a show the community.

Ive written some Ruby code that makes it much much easier to use the LogicMonitor API.
It does all the signing for you so you can just focus on your API calls and worry less about the secure signing. 

https://gist.github.com/ITJamie/4937de9139c682c02c34ff2d17051d58

It uses the following rest-client library https://github.com/rest-client/rest-client and injects the authentication method into the rest-client library. Ive included some examples of usage in my gist. Let me know if your having difficulty and i will test and patch as needed

For an example of how easy this makes using the Rest API

 

temp_url = @URL + '/service/services'
response = RestClient.get(temp_url)

# Printing API server response
puts "\nServer response: #{response}"

 

3 Replies

Replies have been turned off for this discussion
  • Sarah_Terry's avatar
    Sarah_Terry
    Icon for Product Manager rankProduct Manager

    Thanks for sharing, Jamie!  We love to see what power users like yourself come up with.  We are working on publishing SDKs for our REST API in at least a few languages (which will make the authentication less cumbersome), but you beat us to it :)/emoticons/smile@2x.png 2x" title=":)" width="20"> 

  • That's amazing to hear Sarah. Do you plan on working with customers when developing these sdks? This gist I posted is an extract from our larger internal chef library (I hope to publish that some day when I can make it fully generic) would love to get involved in helping ye create a rubygem to cover all usecaes. 

  • Sarah_Terry's avatar
    Sarah_Terry
    Icon for Product Manager rankProduct Manager

    Hi Jamie - We absolutely plan on involving customers, and would love to work with you on this.  We're still figuring out the best way to enable that collaboration, and will reach out soon with more detail.  Thanks!