Reading from and writing to Solid resources

This post informs you on how to perform CRUD operations on a resource by giving a few examples of basic HTTP requests. We can also refer you to the Solid specification for more information.
A big remark here is that there is no access control added in this case. Authorization can be added by placing the following right underneath the request:

DPoP: <DPoP-token>
Authorization: DPoP <token>

To test the following requests, we have set up a sandbox container on https://dev.pods.use.id/sandbox/
Access to this container is public, so you can do anything you want with it (create resources, new containers, change permissions).
Replacing the baseUrl with https://dev.pods.use.id/sandbox/ in the examples should be enough to start testing the example requests.

Reading resources

########
# Check if the example resource exists: returns a 200 response.
# @name checkIfResourceExists
HEAD {{baseUrl}}/{{exampleResource}} HTTP/1.1
########
# Reading a resource: returns a 200 response with the content of the created resource.
# @name readResource
GET {{baseUrl}}/{{exampleResource}}
########
# Reading a resource with content negotiation: returns a 200 response with the content of the created resource, but in a different representation.
# @name readResourceWithContentNegotiation
GET {{baseUrl}}/{{exampleResource}}
Accept: application/ld+json

Writing resources

Resources can be created by sending a PUT request to the full URI of the resource.

########
# Updating a resource: the content is updated. Execute the same previous GET request again to read the resource. The resource file type is also changed to HTML.
# @name updateResource
PUT {{baseUrl}}/{{exampleResource}}
Content-Type: text/html

<b>Hello, <u>world!</u></b>

Also possible, is sending a POST request to the container in which you want to create a resource, and specifying the resource name in a Slug header.

########
# Creating a resource
# @name createResource
POST {{baseUrl}}/
Slug: {{exampleResource}}
Content-Type: text/html

<b>Hello, <u>world!</u></b>

Both of these would accomplish the same, creating the {{exampleResource}} resource in the root container.
The PUT request will overwrite anything that would have been previously there. You will receive a 205 Reset content when that happens. When the resource was not overwritten, a regular 201 Created is returned.
The POST request takes a Slug header as a suggestion for the resource’s name. However, if a resource with this name already exists, it will generate a random UUID as resource name, and write the request body to that. The resource’s final URI can be found in the response’s Location header.

Removing resources

########
# Deleting a resource: the resource file is deleted.
# @name deleteResource
DELETE {{baseUrl}}/{{exampleResource}}