HTTP Response Backends
Create HTTP Response Backend
Request
POST /backends/http_response
Example Request
curl \
-X POST \
-H "Authorization: Bearer {API_KEY}" \
-H "Content-Type: application/json" \
-H "Ngrok-Version: 2" \
-d '{"description":"acme http response","metadata":"{\"environment\": \"staging\"}","body":"I'm a teapot","headers":{"Content-Type":"text/plain"},"status_code":418}' \
https://api.ngrok.com/backends/http_response
Parameters
description | string | human-readable description of this backend. Optional |
metadata | string | arbitrary user-defined machine-readable data of this backend. Optional |
body | string | body to return as fixed content |
headers | Map<string, string> | headers to return |
status_code | int32 | status code to return |
Response
Returns a 201 response on success
Example Response
{
"id": "bkdhr_2TMGJ2ONPI9hANFI6I64gyQsryj",
"uri": "https://api.ngrok.com/backends/http_response/bkdhr_2TMGJ2ONPI9hANFI6I64gyQsryj",
"created_at": "2023-07-31T23:17:40Z",
"description": "acme http response",
"metadata": "{\"environment\": \"staging\"}",
"body": "I'm a teapot",
"headers": {
"content-type": "text/plain"
},
"status_code": 418
}
Fields
id | string | |
uri | string | URI of the HTTPResponseBackend API resource |
created_at | string | timestamp when the backend was created, RFC 3339 format |
description | string | human-readable description of this backend. Optional |
metadata | string | arbitrary user-defined machine-readable data of this backend. Optional |
body | string | body to return as fixed content |
headers | Map<string, string> | headers to return |
status_code | int32 | status code to return |
Delete HTTP Response Backend
Request
DELETE /backends/http_response/{id}
Example Request
curl \
-X DELETE \
-H "Authorization: Bearer {API_KEY}" \
-H "Ngrok-Version: 2" \
https://api.ngrok.com/backends/http_response/bkdhr_2TMGJ2ONPI9hANFI6I64gyQsryj
Response
Returns a 204 response with no body on success
Get HTTP Response Backend
Request
GET /backends/http_response/{id}
Example Request
curl \
-X GET \
-H "Authorization: Bearer {API_KEY}" \
-H "Ngrok-Version: 2" \
https://api.ngrok.com/backends/http_response/bkdhr_2TMGJ2ONPI9hANFI6I64gyQsryj
Response
Returns a 200 response on success
Example Response
{
"id": "bkdhr_2TMGJ2ONPI9hANFI6I64gyQsryj",
"uri": "https://api.ngrok.com/backends/http_response/bkdhr_2TMGJ2ONPI9hANFI6I64gyQsryj",
"created_at": "2023-07-31T23:17:40Z",
"description": "acme http response",
"metadata": "{\"environment\": \"staging\"}",
"body": "I'm a teapot",
"headers": {
"content-type": "text/plain"
},
"status_code": 418
}
Fields
id | string | |
uri | string | URI of the HTTPResponseBackend API resource |
created_at | string | timestamp when the backend was created, RFC 3339 format |
description | string | human-readable description of this backend. Optional |
metadata | string | arbitrary user-defined machine-readable data of this backend. Optional |
body | string | body to return as fixed content |
headers | Map<string, string> | headers to return |
status_code | int32 | status code to return |
List HTTP Response Backends
Request
GET /backends/http_response
Example Request
curl \
-X GET \
-H "Authorization: Bearer {API_KEY}" \
-H "Ngrok-Version: 2" \
https://api.ngrok.com/backends/http_response
Response
Returns a 200 response on success
Example Response
{
"backends": [
{
"id": "bkdhr_2TMGJ2TIm31qPPearUgcXAX7vrq",
"uri": "https://api.ngrok.com/backends/http_response/bkdhr_2TMGJ2TIm31qPPearUgcXAX7vrq",
"created_at": "2023-07-31T23:17:40Z",
"body": "one",
"headers": null,
"status_code": 200
},
{
"id": "bkdhr_2TMGJ2ONPI9hANFI6I64gyQsryj",
"uri": "https://api.ngrok.com/backends/http_response/bkdhr_2TMGJ2ONPI9hANFI6I64gyQsryj",
"created_at": "2023-07-31T23:17:40Z",
"description": "acme http response",
"metadata": "{\"environment\": \"staging\"}",
"body": "I'm a teapot",
"headers": {
"content-type": "text/plain"
},
"status_code": 418
},
{
"id": "bkdhr_2TMGI9f8rFdzz5PANNNn2CTfES0",
"uri": "https://api.ngrok.com/backends/http_response/bkdhr_2TMGI9f8rFdzz5PANNNn2CTfES0",
"created_at": "2023-07-31T23:17:33Z",
"body": "one",
"headers": null,
"status_code": 200
}
],
"uri": "https://api.ngrok.com/backends/http_response",
"next_page_uri": null
}
Fields
backends | HTTPResponseBackend | |
uri | string | |
next_page_uri | string |
HTTPResponseBackend fields
id | string | |
uri | string | URI of the HTTPResponseBackend API resource |
created_at | string | timestamp when the backend was created, RFC 3339 format |
description | string | human-readable description of this backend. Optional |
metadata | string | arbitrary user-defined machine-readable data of this backend. Optional |
body | string | body to return as fixed content |
headers | Map<string, string> | headers to return |
status_code | int32 | status code to return |
Update HTTP Response Backend
Request
PATCH /backends/http_response/{id}
Example Request
curl \
-X PATCH \
-H "Authorization: Bearer {API_KEY}" \
-H "Content-Type: application/json" \
-H "Ngrok-Version: 2" \
-d '{"metadata":"{\"environment\": \"production\"}"}' \
https://api.ngrok.com/backends/http_response/bkdhr_2TMGJ2ONPI9hANFI6I64gyQsryj
Parameters
id | string | |
description | string | human-readable description of this backend. Optional |
metadata | string | arbitrary user-defined machine-readable data of this backend. Optional |
body | string | body to return as fixed content |
headers | Map<string, string> | headers to return |
status_code | int32 | status code to return |
Response
Returns a 200 response on success
Example Response
{
"id": "bkdhr_2TMGJ2ONPI9hANFI6I64gyQsryj",
"uri": "https://api.ngrok.com/backends/http_response/bkdhr_2TMGJ2ONPI9hANFI6I64gyQsryj",
"created_at": "2023-07-31T23:17:40Z",
"description": "acme http response",
"metadata": "{\"environment\": \"production\"}",
"body": "I'm a teapot",
"headers": {
"content-type": "text/plain"
},
"status_code": 418
}
Fields
id | string | |
uri | string | URI of the HTTPResponseBackend API resource |
created_at | string | timestamp when the backend was created, RFC 3339 format |
description | string | human-readable description of this backend. Optional |
metadata | string | arbitrary user-defined machine-readable data of this backend. Optional |
body | string | body to return as fixed content |
headers | Map<string, string> | headers to return |
status_code | int32 | status code to return |