Hi,
I am trying to update my DB via POST and I cannot success... I am using ajax in smal html+js implementation. The code of the request that could be useful for someone to help me is attached after my problem definition.
I have a SPARQL Update query for inserting data to a DB that is hosted in my Stardog server. the query works perfectly in Stardog interface but not doing it via POST. Following the
"SPARQL 1.1 Protocol 2.2.2 update via POST directly" I am including
the SPARQL update request string, unencoded,
and nothing else as the message body of the request. (the query string is "data" variable). In addition, I am settting
the content type header of the HTTP
request to application/sparql-update
. Besides what it is found in the request that is attached, I have trying encoding the query and using other content type and it does not work either.
The error that I have now is [HTTP/1.1 406 application/sparql-update is not an supported accept type 1ms]. If I change to encoded query I am getting [HTTP/1.1 415 application/x-www-form-urlencoded; charset=utf-8 is not a supported input type for /{db} 2ms]
What am I doing wrong in the request? Thanks in advance!
var data = updateQuery;
var urlUpdate = "
http://localhost:5820/myDB/update";
$.ajax({
url: urlUpdate,
type: "POST",
data: data,
headers: {
"Accept": "application/sparql-update"
},
beforeSend: function(xhr) {
xhr.setRequestHeader('Authorization', make_base_auth("admin", "admin"));
}
});