HTTP Requests and API's

HTTP Requests and API's

An introduction to HTTP requests and API's given at an event hosted by the Rutgers Undergraduate Student Alliance of Computer Scientists.

3f8f51e1aa14cdd87cffeaa26bb0ce13?s=128

Eddie Zaneski

March 03, 2014
Tweet

Transcript

  1. HTTP Requests and API’s @eddiezane

  2. None
  3. Verbs • GET • POST • DELETE • … more!

  4. What is an API?

  5. ~ curl -X GET -v ipinfo.io * About to connect()

    to ipinfo.io port 80 (#0) * Trying 23.239.16.243... * Connected to ipinfo.io (23.239.16.243) port 80 (#0) > GET / HTTP/1.1! > User-Agent: curl/7.30.0! > Host: ipinfo.io! > Accept: */*! >! Request
  6. < HTTP/1.1 200 OK < Server: nginx/1.1.19 < Date: Mon,

    03 Mar 2014 21:20:04 GMT < Content-Type: application/json; charset=utf-8 < Content-Length: 222 < Connection: keep-alive < X-Powered-By: Express < ETag: "-1011676620" < Response
  7. { "ip": "128.6.168.245", "hostname": "lawn-gw.rutgers.edu", "city": "Highland Park", "region": "New

    Jersey", "country": "US", "loc": "40.5032,-74.4289", "org": "AS46 Rutgers University", "postal": "08904" } Data
  8. curl -X POST https://api.sendgrid.com/api/mail.send.json \ -d api_user=SENDGRID_USERNAME \ -d api_key=SENDGRID_PASSWORD

    \ -d to=your@email.com \ -d from=your@email.com \ -d subject=HelloFromHackNight \ -d "text=Hello there you fabulous lovely people"
  9. https://github.com/usacs/hacknight/tree/ master/03-03-14