WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: steeld on September 02, 2013, 07:49:23 AM

Title: Anybody used REST with WinBatch?
Post by: steeld on September 02, 2013, 07:49:23 AM
I am trying to use a REST (Representational state transfer) API with a workflow tool called Target Process. I'm not sure where to start. Anybody any clues or pointers about using REST with WinBatch scripts?

Thanks

David
Title: Re: Anybody used REST with WinBatch?
Post by: JTaylor on September 02, 2013, 08:18:35 AM
I normally use MSXML.  Here is a starting point for the retrieval.  Several examples in the Tech Database for reading it after you get it.

Jim

Code (winbatch) Select

  ; Create MSXML Object
  MSXML = ObjectOpen("MSXML.DOMDocument")
  ; Set MSXML Options
  MSXML.Async = 'False'
  MSXML.preserveWhiteSpace = 'False'
  MSXML.validateOnParse = 'True'
  MSXML.resolveExternals = 'False'

  XMLURL =  "YOUR_API_URL"

  ; Issue the request and wait for it to be honored
  Loaded = MSXML.Load(XMLURL)
 
  If !Loaded Then
    Display(2,"Warning","The service is not available.")
    ObjectClose(MSXML)
    Exit
  EndIf
  ; Get root of document
  XML_Root = MSXML.documentElement
  xtxt = XML_Root.xml

  Message("HI",xtxt)

  ;PARSE XML ******************************


  ObjectClose(MSXML)
Title: Re: Anybody used REST with WinBatch?
Post by: stanl on September 02, 2013, 08:26:09 AM
Quote from: steeld on September 02, 2013, 07:49:23 AM
I am trying to use a REST (Representational state transfer) API

Like Jim said. I would troll the Tech Database. You can use MSXML like Jim posted, XMLHttp, or the never Powershell rest cmdlet.
Title: Re: Anybody used REST with WinBatch?
Post by: steeld on September 02, 2013, 12:27:31 PM
Thanks guys. I'll start with that and see what I can come up with.

David