Skip to content

Commit

Permalink
Merge pull request #5 from CodeMyst/fix/api-docs-ratelimit
Browse files Browse the repository at this point in the history
Added rate limits and expiry dates to api docs
  • Loading branch information
CodeMyst committed Nov 10, 2018
2 parents 1900150 + 835ccdf commit 2777bef
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions views/api-docs.dt
Expand Up @@ -11,7 +11,11 @@ block body

h3 API

p The base endpoint for the api is #[a(href="https://paste.codemy.st/api") https://paste.codemy.st/api]
p The base endpoint for the api is #[a(href="https://paste.codemy.st/api") http://paste.codemyst.tk/api]

h4#rate-limit Rate Limit #[a(href="#rate-limit", class="anchor-link") 🔗]

p The API is rate limited to 5 requests a second (a request every 200 milliseconds). After exceeding that limit you will get a #[code 429 (Too Many Requests)] satus code.

h4#create-pastemyst Create a PasteMyst #[a(href="#create-pastemyst", class="anchor-link") 🔗]
span.http-method POST
Expand All @@ -31,10 +35,15 @@ block body
td code
td string
td The contents of the paste uri component encoded (encodeURIComponent).
tbody
tr
td expiresIn
td string
td When the PasteMyst expires. Valid values are: never, 1h, 2h, 10h, 1d, 2d or 1w.

h6 Example PasteMyst POST request
pre.api-code
code(class="hljs json") {
 "code": "QHJvb3RQYXRoRnJvbU5hbWUKY2xhc3MgQXBpIDogSVJlc3QKewoJSnNvbiBwb3N0UGFzdGUgKHN0cmluZyBjb2RlKSBAdHJ1c3RlZAoJewoJCXJldHVybiBjcmVhdGVQYXN0ZSAoY29kZSkuc2VyaWFsaXplVG9Kc29uOwoJfQoKCUpzb24gZ2V0UGFzdGUgKGxvbmcgaWQpIEB0cnVzdGVkCgl7CgkJcmV0dXJuIHBhc3RlbXlzdC5nZXRQYXN0ZSAoaWQpLnNlcmlhbGl6ZVRvSnNvbjsKCX0KfQ=="
}
code(class="hljs json") {
 "code": "public%20class%20I%0A%7B%0A%20%20%20%20public%20string%20Dont%3B%0A%20%20%20%20public%20string%20Know%3B%0A%20%20%20%20public%20string%20Of%3B%0A%20%20%20%20public%20string%20Anything%3B%0A%20%20%20%20public%20string%20Clever%3B%0A%20%20%20%20public%20string%20To%3B%0A%20%20%20%20public%20string%20Put%3B%0A%20%20%20%20public%20string%20Here%3B%0A%7D",
 "expiresIn": "never"
}

h4#get-pastemyst Get a PasteMyst #[a(href="#get-pastemyst", class="anchor-link") 🔗]
span.http-method GET
Expand Down Expand Up @@ -64,7 +73,11 @@ block body
td code
td string
td The contents of the paste uri component encoded (encodeURIComponent).
tr
td expiresIn
td string
td When the PasteMyst expires. Valid values are: never, 1h, 2h, 10h, 1d, 2d or 1w.

h6 Example PasteMystInfo Object
pre.api-code
code(class="hljs json api-code") {
 "id": "br6WorZSdNf6zR",
 "createdAt": 1541188042,
 "code": "QHJvb3RQYXRoRnJvbU5hbWUKY2xhc3MgQXBpIDogSVJlc3QKewoJSnNvbiBwb3N0UGFzdGUgKHN0cmluZyBjb2RlKSBAdHJ1c3RlZAoJewoJCXJldHVybiBjcmVhdGVQYXN0ZSAoY29kZSkuc2VyaWFsaXplVG9Kc29uOwoJfQoKCUpzb24gZ2V0UGFzdGUgKGxvbmcgaWQpIEB0cnVzdGVkCgl7CgkJcmV0dXJuIHBhc3RlbXlzdC5nZXRQYXN0ZSAoaWQpLnNlcmlhbGl6ZVRvSnNvbjsKCX0KfQ=="
}
code(class="hljs json api-code") {
 "id": "br6WorZSdNf6zR",
 "createdAt": 1541188042,
 "code": "public%20class%20I%0A%7B%0A%20%20%20%20public%20string%20Dont%3B%0A%20%20%20%20public%20string%20Know%3B%0A%20%20%20%20public%20string%20Of%3B%0A%20%20%20%20public%20string%20Anything%3B%0A%20%20%20%20public%20string%20Clever%3B%0A%20%20%20%20public%20string%20To%3B%0A%20%20%20%20public%20string%20Put%3B%0A%20%20%20%20public%20string%20Here%3B%0A%7D",
 "expiresIn": "never"
}

0 comments on commit 2777bef

Please sign in to comment.