0

I'm trying to create a program that will allow one to POST numbers, GET subtraction, and DELETE/clear the list of numbers.

Does anyone have a good resource to learn from or any advice in doing this? How would I go about posting an int value?

halfer
  • 19,824
  • 17
  • 99
  • 186
Intrepid Diamond
  • 462
  • 1
  • 6
  • 16

1 Answers1

0

You should go over the REST principles & go over the REST Verbs of GET/POST/DELETE etc.. this answer explains it well. Understanding REST: Verbs, error codes, and authentication, skip the authentication part but focus on understanding the verbs. It helps to think of it like state transitions.

Specifically:

Stateless

The client–server communication is further constrained by no client context being stored on the server between requests. Each request from any client contains all the information necessary to service the request, and session state is held in the client. The session state can be transferred by the server to another service such as a database to maintain a persistent state for a period and allow authentication. The client begins sending requests when it is ready to make the transition to a new state. While one or more requests are outstanding, the client is considered to be in transition. The representation of each application state contains links that may be used the next time the client chooses to initiate a new state-transition.

From your question it appears that you want to build a calculator or some kind. So either your server needs to keep track of what numbers and operations a user has sent it and store it somewhere or your client needs to send it with each request.

For programming the client I would look into the Apache HTTP Libraries. They will work well enough to create a TCP Client to send a POST or GET request to a TCP Server. Apache Maven would be the standard way to include the libraries in your project but you could download the JAR's and include them too.

Community
  • 1
  • 1
Sid
  • 465
  • 6
  • 14