update to insanity

I have updated The Respondinator. You’ll find examples on how to interact below, and quick and dirty summary.

  • POST is a creation method, and only requires path/response (will reject routes that already exist)
  • PUT is an update method, and requires path/response/key (will reject payloads with invalid keys or if it doesn’t have the key)
  • Response can be valid JSON or string

How to ADD a route

  • HTTP POST to https://dbag.tech/routes/addme with a JSON payload that contains a path and response key

Example string:

$> curl -s -d '{"path": "/hello", "response": "world"}' https://dbag.tech/routes/addme

Example JSON:

$> curl -s -d '{"path": "/hello", "response": { "world": { "hello": "world" } }}' https://dbag.tech/routes/addme

Response:

{
  "path": "/hello",
  "response": "{\"key\":{\"subkey\":\"value\"}}",
  "key": "b08421d1-4cd5-4668-96d2-bf1467430db5"
}

How to UPDATE a route

  • HTTP PUT to https://dbag.tech/routes/addme with a JSON payload that contains a path, response, and key
$> curl -s -XPUT -d '{"path": "/hello", "response": { "world": { "hello": "dbag" } }, "key": "b08421d1-4cd5-4668-96d2-bf1467430db5"}' https://dbag.tech/routes/addme

How to GET a route

  • HTTP GET to https://dbag.tech/routes/:route
$> curl -s https://dbag.tech/routes/hello | jq .

{
  "world": {
    "hello": "dbag"
  }
}
Ryan Gravlin's Picture

About Ryan Gravlin

Over 25 years experience as a system operator.

Miami, FL https://dbag.tech

Comments