status endpoint query params and remove links

This commit is contained in:
diminator 2017-01-06 11:58:34 +01:00 committed by tim
parent 6cf39542ea
commit 8bbaa0e40e
2 changed files with 9 additions and 15 deletions

View File

@ -70,16 +70,16 @@ Content-Type: application/json
TPLS['post-tx-response'] = """\ TPLS['post-tx-response'] = """\
HTTP/1.1 202 Accepted HTTP/1.1 202 Accepted
Content-Type: application/json Content-Type: application/json
Location: ../statuses/%(txid)s Location: ../statuses?tx_id=%(txid)s
{ {
"status": "/statuses/%(txid)s" "status": "/statuses?tx_id=%(txid)s"
} }
""" """
TPLS['get-statuses-tx-request'] = """\ TPLS['get-statuses-tx-request'] = """\
GET /statuses/%(txid)s HTTP/1.1 GET /statuses?tx_id=%(txid)s HTTP/1.1
Host: example.com Host: example.com
""" """
@ -90,10 +90,7 @@ HTTP/1.1 200 OK
Content-Type: application/json Content-Type: application/json
{ {
"status": "invalid", "status": "invalid"
"_links" : {
"block": "/blocks/%(blockid)s"
}
} }
""" """
@ -104,11 +101,7 @@ Content-Type: application/json
Location: ../transactions/%(txid)s Location: ../transactions/%(txid)s
{ {
"status": "valid", "status": "valid"
"_links" : {
"tx" : "/transactions/%(txid)s",
"block": "/blocks/%(blockid)s"
}
} }
""" """

View File

@ -257,12 +257,13 @@ Transactions
Statuses Statuses
-------------------------------- --------------------------------
.. http:get:: /statuses/{tx_id|block_id} .. http:get:: /statuses?tx_id={tx_id}|block_id={block_id}
Get the status of an asynchronously written resource by their id. Get the status of an asynchronously written resource by their id.
Supports the retrieval of a status for a transaction using ``tx_id`` or the Supports the retrieval of a status for a transaction using ``tx_id`` or the
retrieval of a status for a block using ``block_id``. retrieval of a status for a block using ``block_id``. Only use exactly one of both
queries, as they are required but mutually exclusive.
The possible status values are ``backlog``, ``undecided``, ``valid`` or The possible status values are ``backlog``, ``undecided``, ``valid`` or
``invalid``. ``invalid``.
@ -312,7 +313,7 @@ Blocks
that was labeled ``UNDECIDED`` or ``INVALID`` is requested by that was labeled ``UNDECIDED`` or ``INVALID`` is requested by
``block_id``, this endpoint will return a ``404 Not Found`` status code ``block_id``, this endpoint will return a ``404 Not Found`` status code
to warn the user. To check a block's status independently, use the to warn the user. To check a block's status independently, use the
`Statuses endpoint <#get--statuses-tx_id|block_id>`_. The ``INVALID`` status `Statuses endpoint <#get--statuses?tx_id=tx_id|block_id=block_id>`_. The ``INVALID`` status
can be handy to figure out why the block was rejected. can be handy to figure out why the block was rejected.
:param block_id: block ID :param block_id: block ID