JADE  Environment Development Ideas

REST api consumer

Jade now has a REST provider and the logical next step is to provide support for a REST consumer. SOAP and REST web service is required from both provider and consumer perspective to be able to play with other vendors of different sizes and backgrounds
  • Brian Henwood
  • May 1 2019
  • Executing
Julie Harliwich 23/10/2018 2:38:11 PM
I think some helper methods would be great, or at the minimum some sample code. We got a Rest API consumer working by reimplementing JadeHttpConnection, but took a while to work out all the right options and tactics for handling request and response data. Have only used it to call APIs for one provider, not sure if it will work for any others. Our provider was Hong Kong based so got caught out by string/stringUtf8

John Richards 7/03/2018 2:40:05 PM
I've created a separate JEDI for the _type issue. Number 130.

Mauritz Viljoen 15/02/2018 12:57:46 PM
I think a good example would be to look at RestSharp (http://restsharp.org/) and duplicate what they have done.
It is a .NET Rest API client that I used in Jade to be able to easily consume REST from Jade. It would be nice to not have to use an external .NET dll.
As Troy have mentioned, have a way to easily add headers, parameters, url segments, certificates etc. Also allow for varying authentication methods.

I also think the JadeJson parser is a bit limited as it seems to be only intended to be used by REST provider in Jade.
Consuming a non Jade REST provider in Jade that requires JSON makes it a bit hard using JadeJson class to generate the JSON because the JadeJson class adds "__type" for instance and having a strick REST provider will reject JSON with invalid parameters, ie "__type", making the JadeJson parser useless.
So would be nice to add more functionality to the JadeJson parser. Allow us to remove "_type", have a way to prevent properties of a class to be added to the json string.
Also would be very helpful, if possible and maybe a long-shot, to have the ability to pass a parent class to the JadeJson parser and it being smart enough to know which subclass it should generate based on what is in json string, without having "__type" in the json string.

John Richards 7/02/2018 11:25:37 AM
Could you please provide more details of the functionality you would like JADE to provide.

Troy Fowles 21/12/2017 3:09:07 PM
A RestConsumer class wrapping the use of JadeHTTPConnection would be great. Make it easier to add request headers for authorization - WinHTTP -
setRequestHeader, make _httpHeaderAdd public.
Expose the Winhttp setClientCertificate so SSL certs can be used for authentication.

Mike Day 1/12/2017 10:18:51 AM
I'd be interested if you had some "helper" methods available to write a REST consumer. Even if they were not ready for official release yet. This is because we have a project with tight timeframes coming up and I don't really want to have to write something in .Net and import it back into Jade if I have to.

Brian Henwood 3/10/2017 10:32:34 AM
Yes, that would be correct

Brian Johnstone 27/09/2017 9:41:52 AM
Most REST services don't provide a rest equivalent of a WSDL, such as a WADL/RSDL, and indeed there are vigorous arguments about why WADL/RSDL is a "bad" idea. Given that there is therefore nothing to "import" to create proxy classes/properties/methods, as happens with SOAP's WSDL, I'm assuming what you're asking for is some additional "helper" classes/methods to help developers write a REST consumer using the relevant documentation of the REST service to know what services/calls are available?
  • Attach files
  • Dermot Barrett commented
    11 Oct 07:27

    As this "idea" is in "executing" can you provide details of what verbs you intend to support?Ideally we would like support for verbs: PATCH, PUT and DELETE (alongside GET & POST already supported) 

  • Admin
    Ashley Bass commented
    16 Oct 04:49

    Hi Dermot, we can.  I will loop in the experts and get them to supply more details asap!

  • Admin
    Ashley Bass commented
    18 Oct 01:42

    Hi again, Dermot: We're currently intending to support GET, PUT, POST, and DELETE from the JADE REST client. We are also considering OPTIONS and PATCH for the client. All verbs that are supported with the JADE REST Client would also be available for the the JadeHTTPConnection sendRequest method also.

    Posting on behalf of the developer, Tim, who for some reason can't post :-(