Web Service Consuming REST API with token

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Web Service Consuming REST API with token

  • Creator
    Topic
  • #54907
    Jerry Tilsley
    Participant

    Anyone out there using the Cloverleaf Web Services module to consume Web REST API’s that require the use of an authentication token?

    I have the connection working using TclCurl, but want to move this to the native protocols of Cloverleaf.  I know I need to override the header values, but have not been successful in getting this to work.  Any help or pointers would be greatly appreciated.

    Thanks,

    Jerry

Viewing 3 reply threads
  • Author
    Replies
    • #83419
      John Mercogliano
      Participant

      Hi Jerry,

         With some help from Infor, here is a sample of what I’m using to call the Global Monitor Webservice.

      Code:


      catch { curl::transfer -url https://intenggmapp01.corp.ad.sentara.com/gmx/rest/views/hci
      -verbose 1
      -errorbuffer strCurlError
      -sslverifypeer 0
      -httpheader [list “Authentication: basic [encode :]” “User-Agent: AppName:Interface Engine” “Accept: application/json”]
      -bodyvar ::strBody
      -headervar ::strHeader
      -cookiejar [file join $::HciSiteDir jmcookie.txt]
      } strResult


      In my case the first call logged in and setup the cookiejar. The encoding of the username and password was a GM requirement.  

      Code:


      catch { curl::transfer -url https://intenggmapp01.corp.ad.sentara.com/gmx/rest/view/33
      -verbose 1
      -errorbuffer strCurlError
      -httpheader [list “User-Agent: AppName:Interface Engine” “Accept: application/json”]
      -sslverifypeer 0
      -bodyvar ::strBody
      -cookiefile [file join $::HciSiteDir jmcookie.txt]
      } strResult


      All calls after use the cookie file to pass the authenticated session info.

      Code:


      catch { curl::transfer -url https://intenggmapp01.corp.ad.sentara.com/gmx/rest/session
      -verbose 1
      -errorbuffer strCurlError
      -httpheader [list “User-Agent: AppName:Interface Engine” “Accept: application/json”]
      -sslverifypeer 0
      -customrequest DELETE
      -cookiefile [file join $::HciSiteDir jmcookie.txt]
      } strResult


      This final call deletes the session and logs you out.  This part will be webservice dependent.

      Hopefully, this helps.

      John Mercogliano
      Sentara Healthcare
      Hampton Roads, VA

    • #83420
      John Mercogliano
      Participant

      I really should not answer things without coffee.  I see you already have it working with tclcurl.  Sorry, I have not tried it with webservices addon, yet.

      John Mercogliano
      Sentara Healthcare
      Hampton Roads, VA

    • #83421
      Jerry Tilsley
      Participant

      Thanks John for the reply.  I think for the token piece I will have to go to the tclCurl route, but time will tell.

      Jerry

    • #83422
      Phil Costner
      Participant

      Has anyone been able to consume a  Web REST API’s that require the use of an authentication token using Cloverleaf Web Services?

Viewing 3 reply threads
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,432
Topic Tags
286
Empty Topic Tags
10