Making a Request
To make a request to the Cookie Microservice, send an HTTP request to the following address:
{hostname}:8001/get_cookie?darkmode={value}
NOTES:
- The hostname will depend on the hosting method selected. Should the microservice be hosted on a web hosting platform, then the hostname will correspond to that platform. If Docker is chosen, then the hostname will correspond to the Docker container in which the program is running.
- The value assigned to the darkmode query parameter is not checked or interpreted by the microservice. It is intended as a boolean, but the Cookie Microservice is not dependent on the manner in which the boolean is set. Thus, the caller may set whatever value it wishes and must be prepared to properly interpret that value once it is set in the cookie.
Receiving a Response
To receive the response from the Cookie Microservice, simply check the HTTP response that is sent back after making a request. The cookie may be found in the Set-Cookie portion of the response header. The cookie name is simply 'cookie' and the value is a JSON string that contains the userId and darkMode values. An example JSON string is as follows:
"userId": AjsJgh35has, "darkMode": False
NOTES:
- The userId value will be a randomized, 12 character alphanumeric string
- The darkMode value will be whatever value was contained in the query parameter received in the request
Diagram