[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ftpapi] HTTP XML



Ron,

Putting JSON into the URL is a highly unusual thing to do. Putting it somewhere besides the query string would be even more unusual. Are you sure this is what you want to do?

Usually JSON data would be sent as POST data. So you would use the http_url_post API (or post_raw, post_stmf, post_raw2, depending on the need) and you would specify your input JSON data as the POST data.

Again, I'm not familiar with this web service, so if that is really what it calls for... fine, put it into the URL. But, it'd be a very weird and unusual thing.

-SK


On 1/5/2017 3:17 PM, Ron Koontz wrote:
I as using the URL_Get and I think I needed to use the URL_post.  The 3rd party wanted me to pass json for the parms.  So like calling a program with some parameters only in their format.  So I tried the url_post and I am much closer.
Example:
eval      rc=http_url_post(%trim(URL):
                %addr(data): %len(%trimr(data)):
                '/tmp/httptest.json')

So basically I need to pass some parms in the url but not part of the string of the url.  That's where the posts comes in I think.
If it helps there documentation is: https://www.samsara.com/api

I'm getting closer



Thanks
Ron Koontz


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Thursday, January 05, 2017 4:11 PM
To: FTPAPI/HTTPAPI mailing list
Subject: Re: [Ftpapi] HTTP XML

Ron,

HTTPAPI works very nicely with the (open source) YAJL JSON tool. You can find a copy of that tool here:

http://www.scottklement.com/yajl/

Aside from that, I don't understand your question.  I don't understand what you don't know how to do in HTTPAPI, you say you have to "pass some parameters" or a "data file".  Do you mean that you need to send data that is encoded like a web form?  (Is that what you mean by
"parameters"?)  When you say "data file" do you mean it should be sent from a file rather than added to the query string portion of the URL?

If so, HTTPAPI provides a set of "webform" routines that can be used to encode data.  That data can be added to the URL, or can be sent as POST data, depending on how it is used.

It is not completely clear from your message what you are looking for.
I do not have the time to read the documentation at the web site you
provided, however.    If you can tell me exactly what you want to do
with HTTPAPI, I'd be happy to offer advice... but I don't have time to do the research into this particular web service.

Good luck




On 1/5/2017 8:37 AM, Ron Koontz wrote:
All,

                 So we have been using the HTTP to grab XML and parse
it without any problems.  Now we have a 3^rd party that we will need
to call their API and return JSON.  Now I know this is not a support
for JSON but the calling of the API should be the same I would think.
Just returning a different format.  ( I have called a different  API
to return the JSON the same way below and could parse it but the 3^rd
party "calling" is different. It was an entirely different 3^rd party
that was on the web for free to test.)

So a basic way we always use the XML is like this. ( used an example
program )

url = 'http://www.myweather2.com/developer/forecast.ashx+

         ?uac=6FZ1-pvF8X&query=44011&temp_unit=f&ws_unit=kph';

filename = http_tempfile() + '.xml';

rc = http_url_get( url : filename );

etc........

Now the 3^rd party says we cannot pass a request through a URL like this.

Here is the 3^rd party website ( https://www.samsara.com/api
<https://www.samsara.com/api> )

We have to pass some "parameters" or a "data" file.  I'm not sure how
to do this in the HTTP examples.

Any pointers or pushing me in to the right direction would be great.
I'm close I think but maybe just don't understand it in my head.

Thanks again for all your help.

Continental Express <http://www.ceioh.com/>



*Ron Koontz | IT Manager | Continental Express, Inc*

*10450 State Rt 47 W Sidney, Ohio 45365*

(: Direct: (937) 419.8118*| *(: Tel (800) 497.2100 x118*|*Ê: Fax (937)
498.2155**

*:_rkoontz@xxxxxxxxx <mailto:rkoontz@xxxxxxxxx>_ Visit us on the web:
www.ceioh.com <http://www.ceioh.com/> FB
<https://www.facebook.com/pages/Continental-Express-Inc/39497029058285
5>Twitter
<https://twitter.com/CEIOHIO>


----------------------------------------------------------------------
--

The information contained in this e-mail is intended only for the
individual or entity to whom it is addressed. Its contents (including
any attachments) may contain confidential and/or privileged
information. If you are not an intended recipient you shall not use,
disclose, disseminate, copy or print its contents. If you receive this
e-mail in error, please notify the sender by reply e-mail and delete
and destroy the message. Continental Express, Inc. and its
subsidiaries and affiliates will not be held liable for the unintended
or unauthorized use of any information contained in this email or as a
result of any additions or deletions of information originally
contained in this email.


_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi

________________________________

The information contained in this e-mail is intended only for the individual or entity to whom it is addressed. Its contents (including any attachments) may contain confidential and/or privileged information. If you are not an intended recipient you shall not use, disclose, disseminate, copy or print its contents. If you receive this e-mail in error, please notify the sender by reply e-mail and delete and destroy the message. Continental Express, Inc. and its subsidiaries and affiliates will not be held liable for the unintended or unauthorized use of any information contained in this email or as a result of any additions or deletions of information originally contained in this email.
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi


_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi