Skip to content

A REST API intended for testing purposes that does (almost) anything the API clients asks it to do.

License

Notifications You must be signed in to change notification settings

integrational/spineless

Repository files navigation

Spineless

A REST API that is useful for testing API clients because it responds to HTTP requests that tell it what to do - and it will then spinelessly do as it was told and hence return a HTTP response as per the API client’s wishes.

where

  • HTTP requests are only accepted via HTTPS

  • {path} indicates any non-empty trailing URL path element. In other words, Spineless will respond to requests to any HTTP resource anchored at its base URL https://api.integrational.org/spineless, but a resource must be given and it cannot be nested (i.e., path/subpath will not work).

HTTP query parameters:

  • summaryHeader: Name of the HTTP response header containing all parameters used by the API implementation. Defaults to X-Spineless-Summary

  • delay: Time in milliseconds to wait before returning a HTTP response. Defaults to 0

  • status: HTTP response status code. Defaults to 200

  • type: HTTP response content type. Defaults to application/json

  • body: HTTP response body. Defaults to { "status" : "OK" }

This HTTP GET request relying on defaults

curl -i -X GET https://api.integrational.org/spineless/anyPathWhatsoever

returns

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 127
Connection: keep-alive
Date: Mon, 09 Oct 2017 12:44:56 GMT
x-amzn-RequestId: a740eae3-acef-11e7-a420-49abdae7720c
X-Spineless-Summary: {"summaryHeader":"X-Spineless-Summary","path":"anyPathWhatsoever","delay":0,"status":200,"type":"application/json","body":null}
X-Amzn-Trace-Id: sampled=0;root=1-59db6f48-c937c2f43c447db4788cb0ee
X-Cache: Miss from cloudfront
Via: 1.1 3664cc1fd21a07e55327a9c256fa758a.cloudfront.net (CloudFront)
X-Amz-Cf-Id: iNCJ3wUqL83xcLvXy464OTBus67-Bwc7yNmkto4OI3ivU09lq6yonA==

{"summaryHeader":"X-Spineless-Summary","path":"anyPathWhatsoever","delay":0,"status":200,"type":"application/json","body":null}

The HTTP GET request

curl -i -X GET https://api.integrational.org/spineless/aPath?summaryHeader=X-Sum\&delay=1000\&status=202\&type=text/plain\&body=this+is+a+GET+response+body

returns

HTTP/1.1 202 Accepted
Content-Type: text/plain
Content-Length: 27
Connection: keep-alive
Date: Mon, 09 Oct 2017 12:50:10 GMT
x-amzn-RequestId: 61d02a35-acf0-11e7-9979-b7a444a30618
X-Sum: {"summaryHeader":"X-Sum","path":"aPath","delay":1000,"status":202,"type":"text/plain","body":"this is a GET response body"}
X-Amzn-Trace-Id: sampled=0;root=1-59db7081-c3fe3a5586aeb403978363e3
X-Cache: Miss from cloudfront
Via: 1.1 e77255787d333d7481d3de3a89fb3ee2.cloudfront.net (CloudFront)
X-Amz-Cf-Id: sUWO8-sGiIbQ7_veCRUo6XWNvZTFd63GAYqe39WZKYJT32LO45xxLQ==

this is a GET response body

The HTTP PUT request

curl -i -X PUT https://api.integrational.org/spineless/anotherPath?summaryHeader=X-Sum\&delay=1000\&status=202\&type=text/plain\&body=this+is+a+PUT+response+body

returns

HTTP/1.1 202 Accepted
Content-Type: text/plain
Content-Length: 27
Connection: keep-alive
Date: Mon, 09 Oct 2017 12:50:54 GMT
x-amzn-RequestId: 7c645d40-acf0-11e7-b5ce-a36276120fa0
X-Sum: {"summaryHeader":"X-Sum","path":"anotherPath","delay":1000,"status":202,"type":"text/plain","body":"this is a PUT response body"}
X-Amzn-Trace-Id: sampled=0;root=1-59db70ad-8a9f220352811f5c948ccefa
X-Cache: Miss from cloudfront
Via: 1.1 6fe90cb7a4852d2683f62e862f7a790c.cloudfront.net (CloudFront)
X-Amz-Cf-Id: n299UqsBM4FcjH4-fGW4tkRoMMVzNG4WLMxrrVAzi0H_MnhKkQLmeg==

this is a PUT response body

The HTTP POST request

curl -i -X POST https://api.integrational.org/spineless/yetAnotherPath?summaryHeader=X-Sum\&delay=1000\&status=202\&type=text/plain\&body=this+is+a+POST+response+body

returns

HTTP/1.1 202 Accepted
Content-Type: text/plain
Content-Length: 28
Connection: keep-alive
Date: Mon, 09 Oct 2017 12:51:24 GMT
x-amzn-RequestId: 8e148f11-acf0-11e7-addd-1f77760b5a1c
X-Sum: {"summaryHeader":"X-Sum","path":"yetAnotherPath","delay":1000,"status":202,"type":"text/plain","body":"this is a POST response body"}
X-Amzn-Trace-Id: sampled=0;root=1-59db70cb-37af9f823be2131e152a520d
X-Cache: Miss from cloudfront
Via: 1.1 e77255787d333d7481d3de3a89fb3ee2.cloudfront.net (CloudFront)
X-Amz-Cf-Id: mTmIubvYb2Z8m5XhNFSesjtKUWcFjq34kWtTQCADZo76cSR_TmXvzw==

this is a POST response body

The HTTP DELETE request

curl -i -X DELETE https://api.integrational.org/spineless/aLastPath?summaryHeader=X-Sum\&delay=1000\&status=202\&type=text/plain\&body=this+is+a+DELETE+response+body

returns

HTTP/1.1 202 Accepted
Content-Type: text/plain
Content-Length: 30
Connection: keep-alive
Date: Mon, 09 Oct 2017 12:51:53 GMT
x-amzn-RequestId: 9f7bf9ac-acf0-11e7-8415-0547587d0bbd
X-Sum: {"summaryHeader":"X-Sum","path":"aLastPath","delay":1000,"status":202,"type":"text/plain","body":"this is a DELETE response body"}
X-Amzn-Trace-Id: sampled=0;root=1-59db70e8-da0f07a5b36a94103d264c64
X-Cache: Miss from cloudfront
Via: 1.1 63db28734e1b9429c04087abd41a1692.cloudfront.net (CloudFront)
X-Amz-Cf-Id: h8hW75SrgXzMcDq8ICWPGLeHyK9VvSXbyC-g2SH1iK9C3qLFXwb-vw==

this is a DELETE response body

About

A REST API intended for testing purposes that does (almost) anything the API clients asks it to do.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages