Author: Stephen Russell
Posted: 2018-09-06 at 09:19:51
To be honest, REST is just a way that sets up an interaction in complex
ways without the client knowing anything beforehand about the server and
the resources it hosts. You define that the transmission is going to be
HTTP and then follow the rules for it.
Now your call to the API can be done from a web browser, an app on a phone
or a tablet.
here is something I wrote to get data for ExchangeRates.
apicall.Clear(); // This is a string to hold the params for the call I am
making for data
apicall.Append("api/historical/" + EOM);
apicall.Append(".json?app_id=bbfaf8b299c54f93811b2144f9d33c3e&symbols=GBP,EUR,CAD");
// get the dates for use in the string
HttpResponseMessage httpResponseMessage = await
client.GetAsync(apicall.ToString());
HttpResponseMessage response = httpResponseMessage;
if (response.IsSuccessStatusCode)
{ // put the data returend into a data object I have
local.
eRateReturn rate = await
response.Content.ReadAsAsync<eRateReturn>();
Here is eRateReturn class(s) for data:
public class Rates
{
public float GBP { get; set; }
public float CAD { get; set; }
public float USD { get; set; }
public float EUR { get; set; }
}
public class eRateReturn
{
public float timestamp { get; set; }
public string Base { get; set; }
public DateTime date { get; set; }
public Rates rates {get; set;}
}
On Thu, Sep 6, 2018 at 8:38 AM Chris Davis <chrisd@actongate.co.uk> wrote:
> Thanks for the reply Russell, I have now discovered this particular thing
> also supports REST api, just trying to figure out oAuth
>
> -----Original Message-----
> From: ProfoxTech <profoxtech-bounces@leafe.com> On Behalf Of Stephen
> Russell
> Sent: Thursday, 06 September 2018 14:30
> To: profoxtech@leafe.com
> Subject: Re: SOAP
>
> Too bad that Alan is no longer among us, he redid his application all in
> Web Service calls years ago.
>
> In general, the "service" is a replacement for a data store. You ask for
> data from the service and it gives it to you in SOAP, xml that is. What
> you actually receive is some sort of collection of data, that may have
> collections within it. You could do the same thing in arrays if you wanted
> in VFP.
>
> Now the data is yours to use at your desire. You may have to package the
> data back into XML that mimics the data they sent you for inserts, updates,
> maybe even deletes. Now through the "service" you post that XML pack to
> them.
>
> Today the industry is changing the name from Web Service to API but in
> general it works in much the same way.
>
> On Thu, Sep 6, 2018 at 7:31 AM Chris Davis <chrisd@actongate.co.uk> wrote:
>
> > Is anyone able to share an example of working with a webservice purely
> > in code?
> >
> > Thanks
> >
> > Chris.
> >
> >
> > --- StripMime Report -- processed MIME parts --- multipart/alternative
> > text/plain (text body -- kept)
> > text/html
> > ---
> >
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/CAJidMYLO0pw-JuZWev4c3eDtVkbVR2OWFJinsT_PNwR3bG2PsA@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.