Restful API

Restful API

Postby Rick Lipkin » Mon Nov 12, 2018 5:30 pm

To All

I have seen a few threads on this topic .. I may have an opportunity to communicate between two different applications via the RestFul Api ... I would be most grateful if anyone could point me to any documentation and possibly any Harbour\xHarbor code or classes that anyone has created that I could leverage to see if it is possible to communicate between two applications.

Thanks
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2615
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Restful API

Postby mag071 » Mon Nov 12, 2018 7:04 pm

regards
from the client side hbcurl. / harbor / contrib / hbcurl the good thing is that you can then solve anything with hbcurl restful-apis-ftp-xml-json-ssl etc.

the examples that are there worked correctly for me.
viewtopic.php?f=3&t=33123&p=195146&hilit=curl#p195118

and add link these two libraries
echo c:\hbcurl\hbcurl.lib + >> b32.bc
echo c:\hbcurl\libcurl.lib + >> b32.bc


from the server side in harbor hbhttpd I recommend this video only that is in Spanish.
https://www.youtube.com/watch?v=ivWorfpnnMs
Mario Antonio González Osal
Venezuela
m a g 0 7 1 @ g m a i l. c o m
User avatar
mag071
 
Posts: 140
Joined: Thu Feb 02, 2006 12:09 pm
Location: Venezuela

Re: Restful API

Postby cnavarro » Mon Nov 12, 2018 7:45 pm

Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Restful API

Postby Carlos Mora » Fri Nov 16, 2018 6:56 pm

Hi Rick,
Rick Lipkin wrote:I have seen a few threads on this topic .. I may have an opportunity to communicate between two different applications via the RestFul Api ... I would be most grateful if anyone could point me to any documentation and possibly any Harbour\xHarbor code or classes that anyone has created that I could leverage to see if it is possible to communicate between two applications.

Let me point sth about Rest APIs. AFAIK, in a Rest API there are 2 roles, a sever and a client, so if your plan is to communicate 2 apps then both will have to act as both server and client. Said this, count my +1 to the use of curl for the client side, it is the most complete, manteined and updated library, available in all platforms, so you will find lots of code samples do to whatever you want. So far I've used curl to do http(s), ftp and a great webdav client to replace an insecure ftp connection.
For the server, the current solution is using the contrib httpd. Rafa Carmona shared a repo in Github with a sample server. https://github.com/rafathefull/restful
To design the API interface and endpoints, there is an outstanding stardard to follow, OAS Open API Specification, and wonderful tools that support it.
For design: Swagger Editorhttps://swagger.io/tools/swagger-editor/. You describe every endpoint of the service using YAML in the Swagger editor an it will write the documentacion simultaneously, test tools, etc.
For testing your REST server, I use Postman https://www.getpostman.com/
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Carlos Mora
 
Posts: 988
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: Restful API

Postby Carles » Fri Nov 16, 2018 11:05 pm

Hola,

Mi punto de vista es el siguiente, hoy en dia nuestras aplicaciones windows se han de expandir en un escenario fuera de nuestra red interna. Esto se llama Internet. Si queremos conectarnos a nuestras bases de datos centralizadas en un hosting con nuestra aplicaciones windows la mejor opción y mas segura es via webservice y para ello curl es para mi la mejor opción . Porque ? Porque hemos de empezar a cambiar nuestra manera de pensar y saber que mucha parte del negocio de nuestra aplicación no estará integrado en nuestro exe sino en el cloud. Nuestras aplicaciones (win/web/app) habran de conectarse a este cloud y crear unas llamadas a unos servicios para gestionar nuestras acciones y la mejor manera es via webservice y para ello podemos usar curl como dice Carlos Mora, y estoy completamente de acuerdo.

En estos foros se pueden ver tips sobre conectar directamente con las bases de datos con diferentes librerias, en especial mysql. En entornos pequeños de negocio y red interna quizas sea una solución valida pero no a nivel internet. Yo creo que esto es un error !. Evidentemente lo podemos hacer tecnicamente, incluso en un entorno pequeño de negocio es lo mas fácil, pero si queremos "externalizar" todo/parte de nuestro negocio hemos de tener presente la seguridad de nuestros datos. Una de las grandes questiones es: conectarse directamente a mysql vs. webservices.

El diseño de un pequeño webservice Restful permite integrar una capa de seguridad junto con la posibilidad que diferentes tecnologias y sistemas se puedan conectar de la misma manera con un protocolo que permita compartir sus funcionalidades.

Si tu diseñas un pequeño webservice para actualizar un stock, podras desde FWH + CURL gestionarlos e igualmente desde WEB CURL gestionarlo...

Por muy fácil que sea conectarse por ejemplo a mysql directamente (base de datos mas popular) recomiendo por motivos de seguridad, escalabilidad, mantenimiento... aprender a crear webservices. Hay muchos ejemplos en el foro de conexion via curl. El negocio no esta en el exe encapsulado e incrustado, sino en el cloud....

mis 2 centavos...

Buen fin de semana :-)
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1090
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: Restful API

Postby Carlos Mora » Sat Dec 08, 2018 11:13 am

A little bit out of topic, but to back the idea of using cUrl as a library: CURL in included in Windows 10! I can't tell how long it has been there, but it is. Just open a console window and write 'curl'

Code: Select all  Expand view

Microsoft Windows [Versión 10.0.17134.407]
(c) 2018 Microsoft Corporation. Todos los derechos reservados.

C:\Users\Carlos>curl
curl: try 'curl --help' for more information

C:\Users\Carlos>

 

more info:
https://blogs.technet.microsoft.com/vir ... o-windows/
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Carlos Mora
 
Posts: 988
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: Restful API

Postby Horizon » Mon Mar 15, 2021 5:34 pm



Hi Mr. Navarro,

Is there any documentation server side of restfull api in english?

Thanks.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Re: Restful API

Postby cnavarro » Mon Mar 15, 2021 8:02 pm

Dear Hakan, no, sorry, I have not had time to translate it, but any help you need, I will be happy to help you well here in the forum or by mail if they are topics that cannot be published.
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Restful API

Postby Horizon » Tue Mar 16, 2021 6:32 am

cnavarro wrote:Dear Hakan, no, sorry, I have not had time to translate it, but any help you need, I will be happy to help you well here in the forum or by mail if they are topics that cannot be published.


Thank you very much Mr. Navarro.

I understand there is two side to restfull api. Client side and Server Side.

I am interested in server side like webservice. Should I install web server application. Which one? I looking for information to start.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Re: Restful API

Postby Antonio Linares » Tue Mar 16, 2021 7:40 am

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Restful API

Postby Otto » Tue Mar 16, 2021 10:18 am

Dear Antonio,

Thank you very much for your info.
Please look, this is how I collect your information.
Best regards,
Otto

https://mybergland.com/fwforum/baustein.mp4
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6005
Joined: Fri Oct 07, 2005 7:07 pm

Re: Restful API

Postby Horizon » Tue Mar 16, 2021 11:16 am

Antonio Linares wrote:Building the simplest webservice using mod_harbour:
https://github.com/FiveTechSoft/mod_harbour/blob/master/samples/webservice.prg

Using the above webservice using mod_harbour:
https://github.com/FiveTechSoft/mod_harbour/blob/master/samples/callwebservice.prg


Hi Antonio,

You say The installation of mod harbour first, I understand.

Thank you.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Re: Restful API

Postby Antonio Linares » Tue Mar 16, 2021 3:58 pm

Hakan,

To use mod_harbour, you have to install it first on a server:
https://github.com/FiveTechSoft/mod_harbour

or use the mod_harbour live demo:
https://www.modharbour.org/modharbour_samples/modpro/modpro.prg

You can also hire a mod_harbour server with everything installed and ready to use it:
https://xbhosts.com/
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 70 guests