WIFI Shield CC3000: how to make a REST HTTP request

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
njonas
 
Posts: 79
Joined: Tue Sep 23, 2014 6:16 pm

WIFI Shield CC3000: how to make a REST HTTP request

Post by njonas »

I'd like to make a request without using the IP address, such as the one to Dark Sky:

https://api.forecast.io/forecast/APIKEY ... ,LONGITUDE

The connectTCP method in Adafruit_CC3000.cpp only takes an IP address:

Code: Select all

Adafruit_CC3000_Client Adafruit_CC3000::connectTCP(uint32_t destIP, uint16_t destPort)
(Using the IP of api.forecast.io directly routes back to their main site)

Any suggestions on easy ways/libraries for handling this?

User avatar
njonas
 
Posts: 79
Joined: Tue Sep 23, 2014 6:16 pm

Re: WIFI Shield CC3000: how to make a REST HTTP request

Post by njonas »

Just FYI, I ended up just setting up a NodeJS instance on Heroku that serves as a proxy server to DarkSky and that works...

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: WIFI Shield CC3000: how to make a REST HTTP request

Post by adafruit_support_mike »

The only way for machines to communicate over the internet is through IP addresses. Not using those is like trying to make a phone call without using a phone number. At a basic level, "the internet" is defined as a collection of machines that have IP addresses.

There are some workarounds, like using a machine with an IP address as a proxy, but ultimately you have to be part of the network to communicate with the network.

User avatar
detman
 
Posts: 8
Joined: Sun Jan 18, 2015 9:16 am

Re: WIFI Shield CC3000: how to make a REST HTTP request

Post by detman »

So what is the verdict, can the CC3000 WifiShield from Adafruit make an HTTP REST POST to a website that has a static IP using the Adafruit_CC3000_Client library? For example if I setup a REST application using RUBY on a EC2 with a fixed IP can I have the wifishield POST to it?

I see "connectTCP" however is that not a socket connection where two CC3000 cannot connect at the same time?

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: WIFI Shield CC3000: how to make a REST HTTP request

Post by adafruit_support_mike »

detman wrote:So what is the verdict, can the CC3000 WifiShield from Adafruit make an HTTP REST POST to a website that has a static IP using the Adafruit_CC3000_Client library?
Sure.

The problems only come in when you have a server in your home with an address like 192.168.10.20 (or any other address in the private block) and want to connect to it from outside your LAN. Those address blocks are classified non-routable on the public internet. That limits applies regardless of the hardware you're using for the server or the network connection though.. a million dollars worth of Cisco routers and mainframes will be inaccessible to the public internet if they all have addresses in the 10.x.x.x block.

WRT making two CC3000s talk to each other: sure, you can do that. We have code that makes an Arduino with a CC3000 act as a webserver, so anything that can make an HTTP connection can do a query.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”