REST api on https Protocol

721 views
Skip to first unread message

Milan Mehta

unread,
Oct 27, 2017, 10:40:09 AM10/27/17
to Harbour Users
Dear All,

I need to use REST api on https Protocol. 
I have never used it before. 
Can someone guide or give us small working example ? 
I am sure many of you must be using it. I need to upload and download JSON file using API.

TIA
Milan.

Angel Pais

unread,
Oct 27, 2017, 10:51:40 AM10/27/17
to harbou...@googlegroups.com
Those are 2 very different animals.
JSON uploading / calling can be done independently of the url format of protocoll.

Here you have 3 problems to solve:
1) url decoding on server side, conforming on client side.
2) handling of ssl autentication in your comms.
3) json coding/decoding.



--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-users+unsubscribe@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Milan Mehta

unread,
Oct 27, 2017, 11:21:20 AM10/27/17
to Harbour Users
Dear Angel,

Of the 3 problems you mentioned, we have already handled Json Coding / Decoding part.
I need to take up the first two.

Kindly guide.

TIA
Milan.

Angel Pais

unread,
Oct 27, 2017, 11:51:00 AM10/27/17
to harbou...@googlegroups.com
Part 1 is fairly easy: Just separate your url using / as delimiter


Pretty easy huh ?


Message has been deleted

Teo Fonrouge

unread,
Oct 27, 2017, 2:54:11 PM10/27/17
to Harbour Users

Hi Milan,


Do you need:


1. Build your REST server with Harbour

2. Build your clients with Harbour


In case of 1. :

If you need build your REST server with Harbour then check the Harbor contrib for an

https server at https://github.com/vszakats/harbour-core/tree/master/contrib/hbhttpd,

it has already a simple example on how to build your own eshop, with login access,

list of products and your cart, simple and elegant by Mindaugas Kavaliuskas.


In case of 2. ; you can check some examples of using CURL ( contrib/hbcurl ), or you

can build your own using SSL / TCP Harbour libs, I don't have an example of it.


I've already made small modifications to the original contrib/httpd which allows to

make some additional configurations like set supported methods from client, change

the original init/end tokens to pass values from Harbour to html templates ( AngularJS

uses {{ / }} as init/end token separators for html evaluation and pass additional info

to headers to allow CORS without additional tools o libraries.


It already has a example to serve as HTTP REST provider for the AngularJS quick start

tutorial at:


https://angular.io/guide/quickstart


this Harbour HTTP REST example is at:


https://github.com/tfonrouge/harbour-vszakats/blob/master/contrib/hbhttpd/examples/angularHeroesHTTP.prg



HTH,



best regards,


Teo

Reply all
Reply to author
Forward
0 new messages