Step 6: Run (Part 2)
Run Your Local Web Server
Open a terminal window.
Enter Your Client Credentials
Safeguard your Client ID and Client Secret values. Do not share these with any third parties as anyone with your Client ID and Client Secret values can impersonate you and act fully on your behalf.
Export your registered client credentials (see the Prerequisites) as environment variables.
Identity Provider (the IDP with whom you registered your application):
read -s MY_SOLID_IDP && export MY_SOLID_IDPEnter https://login.inrupt.com
Client ID:
read -s MY_SOLID_CLIENT_ID && export MY_SOLID_CLIENT_IDEnter your Client ID.
Client Secret:
read -s MY_SOLID_CLIENT_SECRET && export MY_SOLID_CLIENT_SECRETEnter your Client Secret.
Authentication Flow Method:
read -s MY_AUTH_FLOW && export MY_AUTH_FLOWEnter client_secret_basic
Run the Application
Once you have entered your client credentials, start your application. From your project ( getting-started/ ) directory, run your Spring Boot application:
For Java, this tutorial assumes a Spring Boot Web Maven Project.
For Kotlin, this tutorial assumes a Spring Boot Web Gradle Project.
Your Web service runs on http://localhost:8080 .
Test the Service
Open another terminal window. To test, call the new endpoints defined in the ExpenseController class:
/api/expenses/receipts/add
Saves a non-RDF resource, namely an image file of a receipt, to a location in the Pod and updates the Expense object with the receipt location. Returns the updated Expense object.
/api/resource/nonRDF/add
Saves a non-RDF resource to a location in the Pod. Returns the identifier (as String) for the saved resource.
Get Pod URL
To find your Pod URL, issue the following curl command, substituting your WebID (e.g., https://id.inrupt.com/yourUserName ):
Upon success, the operation should return an array with your Pod Root URL; for example:
Add a Receipt to Existing Expense
To add a receipt to an existing expense created in Part 1, call the api/expenses/receipts/add endpoint with a local .png file (can be a different file type .jpg , .pdf , etc. as well), substituting the path to your local file and your root container in the request body:
Upon success, the operation should return the updated Expense object as JSON (as well as print out, on the server-side, the content formatted in Turtle):
See also CRUD Module.
Save a Non-RDF File
To save a receipt (a non-RDF resource) to your Pod, issue the following curl command to the api/resource/nonRDF/add endpoint, substituting the path to your local file and your root container in the request body:
Upon success, the operation returns identifier (as string) of the resource:
See also CRUD Module.
Create an Expense Record
Using the receipt saved in the Save a Non-RDF File section, create a new expense that includes the receipt info, substituting your root container in the request body:
Upon success, the operation should return the updated Expense object as JSON (as well as print out, on the server-side, the content formatted in Turtle):
See also CRUD Module.
Last updated