Skip to content

Commit

Permalink
add inspect POST endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelstanley committed Aug 31, 2023
1 parent 992c114 commit b3b8d97
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions inspect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ paths:
/{payload}:
get:
operationId: inspect
summary: Inspect DApp state REST API
summary: Inspect DApp state via GET
description: |
This method sends an inspect-state request to the DApp backend passing the payload string in the URL.
This method sends an inspect-state request to the DApp backend, passing the payload string in the URL.
The payload string should be URL-encoded; the inspect server will decode the string to UTF-8.
If the DApp frontend needs to pass a binary string to the backend then it is advised to use the base64 encoding.
If the DApp frontend needs to pass a binary string to the backend then it is advised to use the POST method.
The response contains a status string and the reports generated by the DApp backend.
The status string can be either 'accept', 'reject', or 'exception'.
Expand All @@ -27,7 +27,7 @@ paths:
When running on machine mode, the whole Cartesi machine is rolled back after processing the inspect-state request.
On host mode, it is advised against changing the DApp backend state when processing an inspect-state request.
Notice that this method is synchronous, so it is not advised to perform resource-intensive operations.
Notice that this method is synchronous, so it is not advised to be used for performing resource-intensive operations.
parameters:
- in: path
Expand All @@ -51,6 +51,32 @@ paths:
schema:
$ref: "#/components/schemas/Error"

post:
operationId: inspect_post
summary: Inspect DApp state via POST
description: |
Differently from the GET method, the POST method sends an inspect-state request to the DApp backend by passing its payload in the request body.
The payload should be a binary.
Other than that, it behaves the same way as described in the GET method.
requestBody:
content: application/octet-stream

responses:
"200":
description: Inspect state response.
content:
application/json:
schema:
$ref: "#/components/schemas/InspectResponse"

default:
description: Error response.
content:
text/plain:
schema:
$ref: "#/components/schemas/Error"

components:
schemas:
InspectResponse:
Expand Down

0 comments on commit b3b8d97

Please sign in to comment.