Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Most public domain software is free, at least at first glance.


devel / comp.lang.clipper.visual-objects / Get dafrom API REST (method GET)

SubjectAuthor
* Get dafrom API REST (method GET)Sebastián BASSANO
`* Re: Get dafrom API REST (method GET)D.J.W. van Kooten
 `- Re: Get dafrom API REST (method GET)Sebastián BASSANO

1
Get dafrom API REST (method GET)

<45999a49-09a1-47fe-8305-0f1f80f536a8n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=996&group=comp.lang.clipper.visual-objects#996

  copy link   Newsgroups: comp.lang.clipper.visual-objects
X-Received: by 2002:a05:6214:29c8:: with SMTP id gh8mr6051165qvb.78.1640358143576;
Fri, 24 Dec 2021 07:02:23 -0800 (PST)
X-Received: by 2002:a37:6596:: with SMTP id z144mr4927635qkb.314.1640358143394;
Fri, 24 Dec 2021 07:02:23 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.clipper.visual-objects
Date: Fri, 24 Dec 2021 07:02:23 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=201.179.11.97; posting-account=uZKv0QoAAADWPw3SFlyzu0XF3u85G-5e
NNTP-Posting-Host: 201.179.11.97
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <45999a49-09a1-47fe-8305-0f1f80f536a8n@googlegroups.com>
Subject: Get dafrom API REST (method GET)
From: ccyasa.sbassano@gmail.com (Sebastián BASSANO)
Injection-Date: Fri, 24 Dec 2021 15:02:23 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 154
 by: Sebastián BASSANO - Fri, 24 Dec 2021 15:02 UTC

Hi, i'm trying to consume API REST from VO.
For example:

https://test.senasa.gov.ar/agrotraza/src/api/Consulta_Tipo_Envase?authUser=USER&authPass=PASSWORD

returns

["Error de autenticaci\u00f3n (2) USER"]

but from VO i always get empty response.
I try:

Option 1
cRequest:= "authUser=USER&authPass=PASSWORD"
oHttpSession:= CHttp{"SENASA.APIREST"}
IF oHttpSession:ConnectRemote("http://test.senasa.gov.ar")
IF oHttpSession:OpenRequest("GET", "/agrotraza/src/api/Consulta_Tipo_Envase", INTERNET_FLAG_RELOAD + INTERNET_FLAG_KEEP_CONNECTION)
IF oHttpSession:SendRequest(NULL_STRING, PTR(_CAST, cRequest), SLen(cRequest))
cResponse:= oHttpSession:GetResponse()
InfoBox{SELF, "1.Response", cResponse}:Show()
ELSE
WarningBox{SELF, "1.Error.1", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRequest()
ELSE
WarningBox{SELF, "1.Error.2", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRemote()
oHttpSession:= NULL_OBJECT
ELSE
WarningBox{SELF, "1.Error.3", oHttpSession:ErrorMsg}:Show()
ENDIF

Option 2
oHttpSession:= CHttp{"SENASA.APIREST", 443}
IF oHttpSession:ConnectRemote("https://test.senasa.gov.ar")
IF oHttpSession:OpenRequest("GET", "/agrotraza/src/api/Consulta_Tipo_Envase", INTERNET_FLAG_RELOAD + INTERNET_FLAG_KEEP_CONNECTION + INTERNET_FLAG_SECURE)
IF oHttpSession:SendRequest(NULL_STRING, PTR(_CAST, cRequest), SLen(cRequest))
cResponse:= oHttpSession:GetResponse()
InfoBox{SELF, "2.Response", cResponse}:Show()
ELSE
WarningBox{SELF, "2.Error.1", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRequest()
ELSE
WarningBox{SELF, "2.Error.2", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRemote()
oHttpSession:= NULL_OBJECT
ELSE
WarningBox{SELF, "2.Error.3", oHttpSession:ErrorMsg}:Show()
ENDIF

Option 3
oHttpSession:= CHttp{"SENASA.APIREST"}
IF oHttpSession:ConnectRemote("test.senasa.gov.ar")
IF oHttpSession:OpenRequest("GET", "/agrotraza/src/api/Consulta_Tipo_Envase", INTERNET_FLAG_RELOAD + INTERNET_FLAG_KEEP_CONNECTION)
IF oHttpSession:SendRequest(NULL_STRING, PTR(_CAST, cRequest), SLen(cRequest))
cResponse:= oHttpSession:GetResponse()
InfoBox{SELF, "3.Response", cResponse}:Show()
ELSE
WarningBox{SELF, "3.Error.1", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRequest()
ELSE
WarningBox{SELF, "3.Error.2", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRemote()
oHttpSession:= NULL_OBJECT
ELSE
WarningBox{SELF, "3.Error.3", oHttpSession:ErrorMsg}:Show()
ENDIF

Option 4
oHttpSession:= CHttp{"SENASA.APIREST", 443}
IF oHttpSession:ConnectRemote("test.senasa.gov.ar")
IF oHttpSession:OpenRequest("GET", "/agrotraza/src/api/Consulta_Tipo_Envase", INTERNET_FLAG_RELOAD + INTERNET_FLAG_KEEP_CONNECTION + INTERNET_FLAG_SECURE)
IF oHttpSession:SendRequest(NULL_STRING, PTR(_CAST, cRequest), SLen(cRequest))
cResponse:= oHttpSession:GetResponse()
InfoBox{SELF, "4.Response", cResponse}:Show()
ELSE
WarningBox{SELF, "4.Error.1", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRequest()
ELSE
WarningBox{SELF, "4.Error.2", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRemote()
oHttpSession:= NULL_OBJECT
ELSE
WarningBox{SELF, "4.Error.3", oHttpSession:ErrorMsg}:Show()
ENDIF

Option 5
oHttpSession:= CHttp{"SENASA.APIREST"}
IF oHttpSession:ConnectRemote("http://test.senasa.gov.ar")
cResponse:= oHttpSession:GetDocumentByURL("http://test.senasa.gov.ar/agrotraza/src/api/Consulta_Tipo_Envase?authUser=USER&authPass=PASSWORD")
InfoBox{SELF, "5.Response", cResponse}:Show()
ELSE
WarningBox{SELF, "5.Error.1", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRemote()
oHttpSession:= NULL_OBJECT

Option 6
oHttpSession:= CHttp{"SENASA.APIREST", 443}
IF oHttpSession:ConnectRemote("https://test.senasa.gov.ar")
cResponse:= oHttpSession:GetDocumentByURL("https://test.senasa.gov.ar/agrotraza/src/api/Consulta_Tipo_Envase?authUser=USER&authPass=PASSWORD")
InfoBox{SELF, "6.Response", cResponse}:Show()
ELSE
WarningBox{SELF, "6.Error.1", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRemote()
oHttpSession:= NULL_OBJECT

Option 7
oHttpSession:= CHttp{"SENASA.APIREST"}
IF oHttpSession:ConnectRemote("test.senasa.gov.ar")
cResponse:= oHttpSession:GetDocumentByURL("test.senasa.gov.ar/agrotraza/src/api/Consulta_Tipo_Envase?authUser=USER&authPass=PASSWORD")
InfoBox{SELF, "7.Response", cResponse}:Show()
ELSE
WarningBox{SELF, "7.Error.1", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRemote()
oHttpSession:= NULL_OBJECT

Option 8
oHttpSession:= CHttp{"SENASA.APIREST", 443}
IF oHttpSession:ConnectRemote("test.senasa.gov.ar")
cResponse:= oHttpSession:GetDocumentByURL("test.senasa.gov.ar/agrotraza/src/api/Consulta_Tipo_Envase?authUser=USER&authPass=PASSWORD")
InfoBox{SELF, "8.Response", cResponse}:Show()
ELSE
WarningBox{SELF, "8.Error.1", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRemote()
oHttpSession:= NULL_OBJECT

Can any help me?
Regards.
Sebastián

Re: Get dafrom API REST (method GET)

<ocrcsgdd1c2dhacrpkrh005tff4462i645@4ax.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=999&group=comp.lang.clipper.visual-objects#999

  copy link   Newsgroups: comp.lang.clipper.visual-objects
Path: i2pn2.org!i2pn.org!aioe.org!EkPdo1gWLtWTKO760KWasQ.user.46.165.242.91.POSTED!not-for-mail
From: vankooten@removethis.ic2.com (D.J.W. van Kooten)
Newsgroups: comp.lang.clipper.visual-objects
Subject: Re: Get dafrom API REST (method GET)
Date: Sat, 25 Dec 2021 02:18:04 +0100
Organization: IC2
Message-ID: <ocrcsgdd1c2dhacrpkrh005tff4462i645@4ax.com>
References: <45999a49-09a1-47fe-8305-0f1f80f536a8n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="15256"; posting-host="EkPdo1gWLtWTKO760KWasQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Newsreader: Forte Free Agent 3.1/32.783
X-Notice: Filtered by postfilter v. 0.9.2
 by: D.J.W. van Kooten - Sat, 25 Dec 2021 01:18 UTC

Replying on message of Fri, 24 Dec 2021 07:02:23 -0800 (PST) from
Sebastián BASSANO:

Hello Sebastián

>Hi, i'm trying to consume API REST from VO.
>For example:
>
>https://test.senasa.gov.ar/agrotraza/src/api/Consulta_Tipo_Envase?authUser=USER&authPass=PASSWORD
>
>returns
>
>["Error de autenticaci\u00f3n (2) USER"]
>
>but from VO i always get empty response.

We've had some trouble REST API's (Sending XML) as well, in the X#
forum I asked this question:

https://www.xsharp.eu/forum/public-product/659-rest-service-does-not-work#4634

I don't recall all details but the main problem eventually was that
from VO a user name was not used somehow and when the password was
added directly before the xml (extra key-value-pair in the POST body),
something like this, it worked:

secret=123456&xml= <Root> etc.

Not sure if this helps you but maybe it's eventually the
authentication that fails so the result is empty. We got a test URL
which did not require a login and this returned the right values so we
knew the authentication was the problem.

If you would use an X# based DLL, which you can call from VO, you will
have more logical (.Net) code and many more samples and you will
probably solve it faster.

Dick

Re: Get dafrom API REST (method GET)

<aa19d248-7397-4894-a2e0-304c05f888c6n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1000&group=comp.lang.clipper.visual-objects#1000

  copy link   Newsgroups: comp.lang.clipper.visual-objects
X-Received: by 2002:a37:b5c3:: with SMTP id e186mr9910681qkf.747.1640535425495;
Sun, 26 Dec 2021 08:17:05 -0800 (PST)
X-Received: by 2002:a05:622a:1351:: with SMTP id w17mr12001044qtk.59.1640535425299;
Sun, 26 Dec 2021 08:17:05 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.clipper.visual-objects
Date: Sun, 26 Dec 2021 08:17:05 -0800 (PST)
In-Reply-To: <ocrcsgdd1c2dhacrpkrh005tff4462i645@4ax.com>
Injection-Info: google-groups.googlegroups.com; posting-host=181.90.92.159; posting-account=uZKv0QoAAADWPw3SFlyzu0XF3u85G-5e
NNTP-Posting-Host: 181.90.92.159
References: <45999a49-09a1-47fe-8305-0f1f80f536a8n@googlegroups.com> <ocrcsgdd1c2dhacrpkrh005tff4462i645@4ax.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <aa19d248-7397-4894-a2e0-304c05f888c6n@googlegroups.com>
Subject: Re: Get dafrom API REST (method GET)
From: ccyasa.sbassano@gmail.com (Sebastián BASSANO)
Injection-Date: Sun, 26 Dec 2021 16:17:05 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 46
 by: Sebastián BASSANO - Sun, 26 Dec 2021 16:17 UTC

El Friday, December 24, 2021 a la(s) 10:18:07 PM UTC-3, D.J.W. van Kooten escribió:
> Replying on message of Fri, 24 Dec 2021 07:02:23 -0800 (PST) from
> Sebastián BASSANO:
>
>
> Hello Sebastián
> >Hi, i'm trying to consume API REST from VO.
> >For example:
> >
> >https://test.senasa.gov.ar/agrotraza/src/api/Consulta_Tipo_Envase?authUser=USER&authPass=PASSWORD
> >
> >returns
> >
> >["Error de autenticaci\u00f3n (2) USER"]
> >
> >but from VO i always get empty response.
> We've had some trouble REST API's (Sending XML) as well, in the X#
> forum I asked this question:
>
> https://www.xsharp.eu/forum/public-product/659-rest-service-does-not-work#4634
>
> I don't recall all details but the main problem eventually was that
> from VO a user name was not used somehow and when the password was
> added directly before the xml (extra key-value-pair in the POST body),
> something like this, it worked:
>
> secret=123456&xml= <Root> etc.
>
> Not sure if this helps you but maybe it's eventually the
> authentication that fails so the result is empty. We got a test URL
> which did not require a login and this returned the right values so we
> knew the authentication was the problem.
>
> If you would use an X# based DLL, which you can call from VO, you will
> have more logical (.Net) code and many more samples and you will
> probably solve it faster.
>
> Dick

Thanks Dick.
I'll move to C# and call the code from VO as i do in other oportunities when i got stucked with VO.

Sebastián

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor