3

I'm running a stand alone single-user v5 Node Solid Server. When I log in as that single user, I'm able to create a document in a non-existent container, and the server creates the container for me.

e.g.

POST https://my.server:8443/network/001/call/call-001

@prefix c0: <http://example.org/foo/call#> .
@prefix foo: <http://example.org/foo/> .

<https://my.server:8443/network/001/call/call-0001>
  a foo:call;
  c0:caller "401-555-0001";
  c0:created "2019-05-02T19:54:10.007Z";
  c0:id "call-0001";
  c0:network-id "001";
  c0:receiver "555-555-0002";
  c0:updated "2019-05-02T19:54:10.007Zā€ .

When I post this to my own single user server, and the container /network/001/call doesn't exist, it will create it for me. But when I post this to an Inrupt server (where I own the POD, but not the server, and it isn't in single user mode), I get an error:

500 : Failed to write file after patch: Error: ENOENT: no such file or directory, open '/var/solid/user.inrupt.net/network/001/call/call-001'

So - I'm curious around why it creates the container in one case but not the other, but I suppose for the short term the answer is also that I should be explicitly creating the containers before putting things into them. Unfortunately the task-oriented documentation seems a bit lacking on this at the moment, so thus the title of this question - how do I create a container (POST ...?) on a SoLiD server?

TallTed
  • 9,069
  • 2
  • 22
  • 37
DrTeeth
  • 927
  • 2
  • 10
  • 32
  • I think the Inrupt server is still running v4 of `solid-server`, rather than v5, so perhaps that is the problem? To be sure, you could try it locally with v4 as well. – Vincent May 17 '19 at 09:04
  • That definitely appears to have been the difference in behavior. But it does still seem like I should be able to explicitly create a new container without anything in it, which would make the two equivalent. Just not a lot of easy to find examples on how. – DrTeeth Jun 10 '19 at 18:28

2 Answers2

0

Coming back to this, I now know a bit more about Solid to be able to answer this properly.

So, you should be able to create an empty Container by sending a PUT request with an empty body to the Container URL, with a trailing slash appended to indicate that it is a Container: PUT https://my.server:8443/network/001/call/.

Unfortunately, at the time of writing, the currently most widely-used Solid server software (Node Solid Server) does not support this, so it requires the creation of a file inside it as a workaround. This works, because the Solid spec explicitly says that intermediate Containers should be created as well.

(And of course, you can use a library that abstracts over this for you.)

The error you encountered in the initial question description appears to have been a bug in v4 of NSS that has been fixed by now.

Vincent
  • 4,876
  • 3
  • 44
  • 55
0

I needed to create another inbox at my profile on the inrupt.net Solid server (version Solid 5.6.3 at the time). I tried PUT request like this and it worked:

PUT /inbox2 HTTP/1.1
Cookie: (cookie from browser where I'm logged in)
Link: <.acl>; rel="acl", <.meta>; rel="describedBy", <http://www.w3.org/ns/ldp#Container>; rel="type", <http://www.w3.org/ns/ldp#BasicContainer>; rel="type"
Content-Type: text/turtle
Host: inbox2.inrupt.net
Content-Length: 274
@prefix : <#>.
@prefix inbox: <>.
@prefix ldp: <http://www.w3.org/ns/ldp#>.
@prefix terms: <http://purl.org/dc/terms/>.
@prefix XML: <http://www.w3.org/2001/XMLSchema#>.
@prefix st: <http://www.w3.org/ns/posix/stat#>.
inbox:
a ldp:BasicContainer, ldp:Container.

I took the body from the original inbox.

Tony
  • 1,057
  • 8
  • 14