Hi Tim,

Difficult to tell; both the curl and the XQuery variants give me 404.
Do you think you could provide us with an example that works out of
the box?

Best,
Christian



On Wed, Feb 2, 2022 at 12:54 AM Tim Thompson <timat...@gmail.com> wrote:
>
> Hello,
>
> I'm trying to post a SPARQL query to an endpoint using Digest authentication 
> with the HTTP client.
>
> The query works fine using curl:
>
> curl --digest --user user:pass -X POST -d@'test.rq' \
>     -H "Content-type: application/sparql-query" \
>     'http://example.org/sparql'
>
> But the equivalent request in BaseX fails with 401 Unauthorized:
>
> let $endpoint := "http://example.org/sparql";
> let $user := "user"
> let $pass := "pass"
> let $type := "application/sparql-query"
>
> let $response := (
>   http:send-request(
>     <http:request
>         method="POST"
>         href="{$endpoint}"
>         username="{$user}"
>         password="{$pass}"
>         auth-method="Digest"
>         send-authorization="true">
>         <http:header
>             name="Content-Type"
>             value="{$type}; charset=utf-8"/>
>         <http:body
>             media-type="{$type}">{
>             ``[
>               select * where {?s ?p ?o} limit 1
>             ]``
>           }</http:body>
>     </http:request>
>   )
> )
> return
>   $response
>
> Any ideas about what might be causing the BaseX HTTP client to be denied here?
>
> Thanks in advance,
> Tim
>
>
> --
> Tim A. Thompson
> Metadata Librarian
> Yale University Library
>

Reply via email to