Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated httpMethods.sc #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions ammonite/httpMethods.sc
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,35 @@ object Test {
).get,
keyChain = List(cosyKey,localKey)
)

//----------------------------------------------------------------------------------------------

def deleteLocalKey = http.run(
req = DELETE[`text/turtle`](
resource = Uri("https://localhost:8443/2013/")
)
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you want to delete the whole root container? Would it not be better to delete a file that was previously created perhaps?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unlikely to work it seems to me without a proper credentials.


def getLocalKey = http.run(
req = GETpg(
uri = Uri("https://localhost:8443/2013/"),
keyChain = List(localKey)
)
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would the key be the URL of the container? Have you tried out these functions to see what they return?


def putLocalKey = http.run(
req = PUT[`text/turtle`](
resource = Uri("https://localhost:8443/2013/"),
graph = pubKeyPG.get.graph
).get,
keyChain = List(localKey)
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here you are trying to PUT a resource on the container. POST creates a new resource. But PUT overwrites the one given by the URL. Do you actually want to overwrite the container?


def patchLocal(sparqlUpdateCommand: String) = http.run(
req = PATCHsparql[`text/turtle`](
resource = Uri("https://localhost:8443/2013/"),
sparqlUpdate = sparqlUpdateCommand
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, if you read the curl specs you'll see that there is sparql update on the rww-repo that you can use to get going.

)

}