Logging Into Solid And Making A Request
I should preface this post by mentioning that SOLID appears to still be in the early stages of development, and so this post may become out of date quickly. Currently the initial login step actually requires the username and password be sent in clear text.
If you don’t know about SOLID please head over to https://solid.inrupt.com to learn all about it.
Logging into SOLID
If you haven’t logged in previously then you will need to login manually by supplying your username and password. The response to a successful login request will contain the connect-id cookie which will be used in future requests and login requests:
POST /login/password HTTP/1.1
Host: solid.community
Content-Type: application/x-www-form-urlencoded
username=crmepham2password=testing
The response will contain the header set-cookie with a value similar to:
connect.sid=s%3AowbxP8Nztfz3zzVoeK7pPRNT7sdiuUrU.szxTieghJaJO2WZeZjR348gxyNQgLVp%2BZoUu3FsNLYs;
Domain=.solid.community; Path=/; Expires=Mon, 15 Oct 2018 11:15:54 GMT; HttpOnly; Secure
Sending an authenticated request
With the cookie now set you can make authenticated requests. In this example we will update my cards first name property:
PATCH /profile/card HTTP/1.1
Host: crmepham2.solid.community
Content-Type: application/sparql-update
DELETE DATA { <https://crmepham2.solid.community/profile/card#me> <http://www.w3.org/2006/vcard/ns#fn> "Chris" .
}
; INSERT DATA { <https://crmepham2.solid.community/profile/card#me> <http://www.w3.org/2006/vcard/ns#fn> "Chris Mepham" .
}
Which returns the response “Patch applied successfully.” And can be seen in the SOLID UI.
Read more about the body of the request here.