Go: REST Overview

iOS
3 min readNov 8, 2018

--

In this guide I will explain how REST works.

What does REST stand for?

Representational state transfer. REST gives services the ability to communicate and exchange data.

How does communication happen in REST?

The REST architecture consists of two services: client and server. The client starts the connection by sending a message to server. The server listens for incoming messages, then replies to the client request. Both the client and server use the HTTP protocol.

Why is the HTTP protocol so important when talking about REST?

HTTP is an application-level protocol used for data communication all over the web. HTTP is a client-server, request-response protocol. The client send a request the server. The HTTP server listens for incoming requests and responds accordingly.

What is a client request?

When a client is sending a request to the server it is requesting a resource from the server. If the client is a web browser trying to access a web page, then the client will send a request to the server asking for the HTML page. The HTML page would be the resource returned from the server to the client.

How do you request a resource from the server?

A Rest Client needs a request URL and request Method.

What is a Request URL?

A URL is a web address, example of a REST API URL would be https://jsonplaceholder.typicode.com/todos/1. The URL is inquiring about todos ID 1.

Play around with JSONPlaceholder to get a better understanding about REST:

What is a Request Method?

The request method is basically the type of operation that the client would like to execute. In the HTTP protocol, there are multiple types of method

REST Method

Thanks again for reading, my future articles will be about building a REST API in Go consuming data from Openstate, Followthemoney and Propublica. Stay tuned and if you would like to learn more about something specific let me know.

Please checkout the below links

Resume website — https://tommarler.org

Linkedin — https://www.linkedin.com/in/tom-m-bb4857112/

If you would like to learn more about parsing JSON please view the below links.

Go: JSONhttps://medium.com/@tommarler/go-json-13880dc1f1f8

Go: XML SEOhttps://medium.com/@tommarler/go-xml-and-seo-4adc5226d606

--

--

iOS

iOS Developer, Go, Java, C#, Blockchain enthusiast, Data junkie