Simple GET request to a URL.

Discussion to talk about software related topics only.
Post Reply
jfox21381
Posts: 7
Joined: Tue Feb 03, 2015 1:51 pm

Simple GET request to a URL.

Post by jfox21381 »

I'm working on a project where I need to validate a barcode number, read by a barcode scanner. My client has provided me with an API to validate the scanned number. The information provided to me is as follows:
There is a barcode verification API, that I'd prefer you use, you simply do a GET to a URL with the barcode value in the URL. This will return a 404 if invalid and a 200 (with a JSON body) if it is valid.
I have the URL I need and I don't care about the JSON return, I just need to get the 404 or 200 response. Are there any samples out there on how to accomplish this?
User avatar
pbreed
Posts: 1088
Joined: Thu Apr 24, 2008 3:58 pm

Re: Simple GET request to a URL.

Post by pbreed »

Look at the webclient examples....

The simplest is probably the

nburn\examples\standardstack\webclient\FindMyIp


uses a very similar API....
One line get with a result check...


Paul
jfox21381
Posts: 7
Joined: Tue Feb 03, 2015 1:51 pm

Re: Simple GET request to a URL.

Post by jfox21381 »

Hi Paul,

Thanks! This looks very close to what I need. I got the sample working properly on my device, but when I plug in my clients URL, the DoGet always returns false. I can see the return data when using the URL in a browser.

This is the test url: https://[removed since it's no longer needed]

Is there any way to just get the 404 or 200 results values?
Last edited by jfox21381 on Fri Sep 23, 2016 10:54 am, edited 1 time in total.
User avatar
pbreed
Posts: 1088
Joined: Thu Apr 24, 2008 3:58 pm

Re: Simple GET request to a URL.

Post by pbreed »

that request is HTTPS ie it uses TLS/SLL.
The other is HTTP....

Your site does not seem to respond to http requests....

So you need to get the site to allow http, or you need to purchase add SSL/TLS libraries for Netburner...

Paul
User avatar
pbreed
Posts: 1088
Joined: Thu Apr 24, 2008 3:58 pm

Re: Simple GET request to a URL.

Post by pbreed »

When you sent the http request the
website responds with 301 moved permanently and provides the https address as the location it moved to.


Paul
jfox21381
Posts: 7
Joined: Tue Feb 03, 2015 1:51 pm

Re: Simple GET request to a URL.

Post by jfox21381 »

Ok, that makes sense. I'll ask the client if that can allow the HTTP. Thanks again for your help!
Post Reply