In Swarm, an instruction to upload data to the network goes through 3 consecutive stages before it is completed:
In the splitting state, the file is deconstructed in chunks (Swarms canonical data unit) and packaged in a Binary Merkle Tree. After splitting, the chunks are stored in your local database where they enter a queue, to be sent to the network.
Sending starts immediately when the first chunks are split and stored. After the chunk is sent, your node will receive a receipt from the node that has stored the chunk, marking the completion of the upload for that chunk. After a receipt has been received for all chunks, the upload is complete.
How to track the status of your upload
The status of your upload can be followed by using
tag is a label given to all chunks that belong to the same upload instruction.
The tag label is only known to your node. It is not communicated to the network, only your node will known that a set of chunks belong together.
Generate the tag identifier
To get the status of an upload, we can:
Generate the tag before the upload and pass this tag on upload
To follow the status of your upload while it is splitting you must generate the tag yourself beforehand since the tag-uid is usually communicated only after splitting is complete.
Create a tag by sending a POST request to the
tag API endpoint:
Use the returned UID to instruct your POST upload request to track this upload using the
If you don't want to track the splitting stage, you may omit the
Swarm-Tag-UID header, and a new tag will be automatically created and returned in the HTTP response header after splitting is complete.
You can use
curl --verbose to view the HTTP response headers such as the
Ask for the Current Status
To get the current status of an upload, send a GET request to the
tag/<Swarm-Tag-UID> API endpoint.
The response contains all the information that you need to follow the status of your file as it is synced with the network.