Intro to HTTP and REST
Great, you got to the second page of the Datawrapper API documentation and if you followed the Getting started section, you already used HTTP.
What is HTTP anyways?
HTTP stands for Hypertext Transfer Protocol and is the main communication channel for the web. By entering google.com into your browser, the browser and Google's servers will communicate and send data through HTTP. The Datawrapper API (and Google) use HTTPS (that S means secure, we don't want other people do read your data). HTTPS is an extension of HTTP where your data is encrypted using TLS. Now you read a bunch of abbreviations, and if you want to learn more, follow the links. The important part is that HTTP is how browsers and servers exchange messages.
RESTful APIs
As almost everything on this page, REST is an abbreviation, short for Representational State Transfer. It is a set of guidelines on how to build web services and organize interactions between them. The Datawrapper API mostly conforms to REST guidelines, but deviates where it makes sense for us.
You will mostly work on resources like users
, charts
or teams
and take actions on them with standard HTTP verbs like GET
, POST
, PATCH
and DELETE
. Resources have associated URLs that you operate on. In the Getting started section, you already requested a resource with GET /v3/me
, which tells the server that you want to see your user information.
The Datawrapper API uses the following verbs:
Verb | Explanation | Example |
---|---|---|
GET | Request the representation of a resource. | GET /v3/charts/rjRUb 🔗This will return a JSON representation of the beautiful scatterplot on our landing page. |
POST | Create a new resource. | POST /v3/charts 🔗This will create a new chart that you can edit with the API or through our app. |
PATCH | Modify a resource. | PATCH /v3/me 🔗This action can modify your user information. Try changing your name. |
PUT | Replace an existing resource. | PUT /v3/charts/rjRUb/data 🔗This replaces the chart data with your provided data set. |
DELETE | Delete an existing resource. | DELETE /v3/auth/tokens/<MY_TOKEN> 🔗Deletes an API token. |
Updated about 5 years ago