Quantcast

RESTXQ Params

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RESTXQ Params

Peter Hinkelmanns

Dear all,

 

I’m out of ideas why my implementation of an API with RESTXQ rejects to work. I’m trying to use %rest:query-param to pass parameters:

 

 

(:~
: List all entries and return them as XML.
:)
declare
   
%rest:GET
   
%rest:path("/entries")  
    
%rest:query-param("limit", "{$limit}", 20)
   
%rest:query-param("offset", "{$offset}", 0)
   
%rest:produces("application/xml", "text/xml")
function v1:entries($limit as xs:integer?, $offset as xs:integer?) {

            …

}

 

All requests lead to “Error 405 HTTP method GET is not supported by this URL”. Without the %rest:query-param this request works fine.

Could this be a problem of my server configuration? All examples including the one from Siegel/Retter 2015 seem to look exactly the same like my code snipplet above.

 

Many thanks in advance

Regards

Peter Hinkelmanns

 

 

 


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RESTXQ Params

Adam Retter
Is there any information in your restxq.log file?

On 6 Mar 2017 5:32 p.m., "Peter Hinkelmanns" <[hidden email]> wrote:

Dear all,

 

I’m out of ideas why my implementation of an API with RESTXQ rejects to work. I’m trying to use %rest:query-param to pass parameters:

 

 

(:~
: List all entries and return them as XML.
:)
declare
   
%rest:GET
   
%rest:path("/entries")  
    
%rest:query-param("limit", "{$limit}", 20)
   
%rest:query-param("offset", "{$offset}", 0)
   
%rest:produces("application/xml", "text/xml")
function v1:entries($limit as xs:integer?, $offset as xs:integer?) {

            …

}

 

All requests lead to “Error 405 HTTP method GET is not supported by this URL”. Without the %rest:query-param this request works fine.

Could this be a problem of my server configuration? All examples including the one from Siegel/Retter 2015 seem to look exactly the same like my code snipplet above.

 

Many thanks in advance

Regards

Peter Hinkelmanns

 

 

 


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RESTXQ Params

Dannes Wessels-3
In reply to this post by Peter Hinkelmanns
did you define the v1 namespace?]



On 6 Mar 2017, at 18:19 , Peter Hinkelmanns <[hidden email]> wrote:

function v1:entries($limit as xs:integer?, $offset as xs:integer?) {


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RESTXQ Params

Peter Hinkelmanns
In reply to this post by Adam Retter

Dear Adam,

 

thank you for your feedback!

 

The last statements of restxq.log look like this:

 

2017-02-23 10:21:45,669 [main] INFO  (RestXqServiceRegistryManager.java [getRegistry]:67) - RESTXQ is ready.

2017-03-07 09:15:45,865 [eXistThread-17271] INFO  (AbstractExistHttpServlet.java [getOrCreateBrokerPool]:96) - Database already started. Skipping configuration ...

2017-03-07 09:15:45,883 [eXistThread-17271] INFO  (AbstractExistHttpServlet.java [doGeneralExistServletConfig]:198) - Using default user guest for all unauthorized requests.

 

The complete error-message of the request {myserver}/restxq/entries?limit=50&offset=20 is:

 

<html>

    <head>

        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>

        <title>Error 405 HTTP method GET is not supported by this URL</title>

    </head>

    <body>

        <h2>HTTP ERROR 405</h2>

        <p>Problem accessing /exist/restxq/entries. Reason:

 

            <pre>    HTTP method GET is not supported by this URL</pre>

        </p>

        <hr />

        <i>

            <small>Powered by Jetty://</small>

        </i>

    </body>

</html>

 

So I guess, I should take a look into the jetty config? And again – without parameters (i.e. deleting them from my restxq-api and the request itself) it works fine.

 

Regards

Peter

 

 

Von: Adam Retter [mailto:[hidden email]]
Gesendet: Montag, 6. März 2017 18:46
An: Peter Hinkelmanns <[hidden email]>
Cc: [hidden email]
Betreff: Re: [Exist-open] RESTXQ Params

 

Is there any information in your restxq.log file?

 

On 6 Mar 2017 5:32 p.m., "Peter Hinkelmanns" <[hidden email]> wrote:

Dear all,

 

I’m out of ideas why my implementation of an API with RESTXQ rejects to work. I’m trying to use %rest:query-param to pass parameters:

 

 

(:~
: List all entries and return them as XML.
:)
declare
   
%rest:GET
   
%rest:path("/entries")  
    
%rest:query-param("limit", "{$limit}", 20)
   
%rest:query-param("offset", "{$offset}", 0)
   
%rest:produces("application/xml", "text/xml")
function v1:entries($limit as xs:integer?, $offset as xs:integer?) {

            …

}

 

All requests lead to “Error 405 HTTP method GET is not supported by this URL”. Without the %rest:query-param this request works fine.

Could this be a problem of my server configuration? All examples including the one from Siegel/Retter 2015 seem to look exactly the same like my code snipplet above.

 

Many thanks in advance

Regards

Peter Hinkelmanns

 

 

 


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RESTXQ Params

Adam Retter
I doubt a problem with Jetty.

What happens if you tail the restxq.log, and then modify your query
and hit save?

On 7 March 2017 at 08:34, Peter Hinkelmanns <[hidden email]> wrote:

> Dear Adam,
>
>
>
> thank you for your feedback!
>
>
>
> The last statements of restxq.log look like this:
>
>
>
> 2017-02-23 10:21:45,669 [main] INFO  (RestXqServiceRegistryManager.java
> [getRegistry]:67) - RESTXQ is ready.
>
> 2017-03-07 09:15:45,865 [eXistThread-17271] INFO
> (AbstractExistHttpServlet.java [getOrCreateBrokerPool]:96) - Database
> already started. Skipping configuration ...
>
> 2017-03-07 09:15:45,883 [eXistThread-17271] INFO
> (AbstractExistHttpServlet.java [doGeneralExistServletConfig]:198) - Using
> default user guest for all unauthorized requests.
>
>
>
> The complete error-message of the request
> {myserver}/restxq/entries?limit=50&offset=20 is:
>
>
>
> <html>
>
>     <head>
>
>         <meta http-equiv="Content-Type" content="text/html;
> charset=ISO-8859-1"/>
>
>         <title>Error 405 HTTP method GET is not supported by this
> URL</title>
>
>     </head>
>
>     <body>
>
>         <h2>HTTP ERROR 405</h2>
>
>         <p>Problem accessing /exist/restxq/entries. Reason:
>
>
>
>             <pre>    HTTP method GET is not supported by this URL</pre>
>
>         </p>
>
>         <hr />
>
>         <i>
>
>             <small>Powered by Jetty://</small>
>
>         </i>
>
>     </body>
>
> </html>
>
>
>
> So I guess, I should take a look into the jetty config? And again – without
> parameters (i.e. deleting them from my restxq-api and the request itself) it
> works fine.
>
>
>
> Regards
>
> Peter
>
>
>
>
>
> Von: Adam Retter [mailto:[hidden email]]
> Gesendet: Montag, 6. März 2017 18:46
> An: Peter Hinkelmanns <[hidden email]>
> Cc: [hidden email]
> Betreff: Re: [Exist-open] RESTXQ Params
>
>
>
> Is there any information in your restxq.log file?
>
>
>
> On 6 Mar 2017 5:32 p.m., "Peter Hinkelmanns" <[hidden email]>
> wrote:
>
> Dear all,
>
>
>
> I’m out of ideas why my implementation of an API with RESTXQ rejects to
> work. I’m trying to use %rest:query-param to pass parameters:
>
>
>
>
>
> (:~
> : List all entries and return them as XML.
> :)
> declare
>     %rest:GET
>     %rest:path("/entries")
>     %rest:query-param("limit", "{$limit}", 20)
>     %rest:query-param("offset", "{$offset}", 0)
>     %rest:produces("application/xml", "text/xml")
> function v1:entries($limit as xs:integer?, $offset as xs:integer?) {
>
>             …
>
> }
>
>
>
> All requests lead to “Error 405 HTTP method GET is not supported by this
> URL”. Without the %rest:query-param this request works fine.
>
> Could this be a problem of my server configuration? All examples including
> the one from Siegel/Retter 2015 seem to look exactly the same like my code
> snipplet above.
>
>
>
> Many thanks in advance
>
> Regards
>
> Peter Hinkelmanns
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Announcing the Oxford Dictionaries API! The API offers world-renowned
> dictionary content that is easy and intuitive to access. Sign up for an
> account today to start using our lexical data to power your apps and
> projects. Get started today and enter our developer competition.
> http://sdm.link/oxford
> _______________________________________________
> Exist-open mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/exist-open



--
Adam Retter

eXist Developer
{ United Kingdom }
[hidden email]
irc://irc.freenode.net/existdb

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RESTXQ Params

Peter Hinkelmanns

Dear Adam,

 

I found the sollution:

 

(:~
: List all entries and return them as XML.
:)
declare
   
%rest:GET
   
%rest:path("/entries")
   
%rest:query-param("limit", "{$limit}", '20')
   
%rest:query-param("offset", "{$offset}", '0')
   
%rest:produces("application/xml", "text/xml")
function v1:entries($limit as xs:string*,$offset as xs:string*) {
   
(: Should be passed by parameters  :)
   
let $limit := xs:integer($limit[1])
   
let $offset := xs:integer($offset[1])

                […]

};

 

I tried to pass $limit and $offset as integers (v1:entries($limit as xs:integer*,$offset as xs:integer*)). This simply does not work, so I added the type cast in the function. Works like a charm!

 

Thanks again for your support!

 

Regards

Peter

 

 

-----Ursprüngliche Nachricht-----
Von: Adam Retter [mailto:[hidden email]]
Gesendet: Dienstag, 7. März 2017 11:04
An: Peter Hinkelmanns <[hidden email]>
Cc: [hidden email]
Betreff: Re: [Exist-open] RESTXQ Params

 

I doubt a problem with Jetty.

 

What happens if you tail the restxq.log, and then modify your query and hit save?

 

On 7 March 2017 at 08:34, Peter Hinkelmanns <[hidden email]> wrote:

> Dear Adam,

> 

> 

> 

> thank you for your feedback!

> 

> 

> 

> The last statements of restxq.log look like this:

> 

> 

> 

> 2017-02-23 10:21:45,669 [main] INFO 

> (RestXqServiceRegistryManager.java

> [getRegistry]:67) - RESTXQ is ready.

> 

> 2017-03-07 09:15:45,865 [eXistThread-17271] INFO

> (AbstractExistHttpServlet.java [getOrCreateBrokerPool]:96) - Database

> already started. Skipping configuration ...

> 

> 2017-03-07 09:15:45,883 [eXistThread-17271] INFO

> (AbstractExistHttpServlet.java [doGeneralExistServletConfig]:198) -

> Using default user guest for all unauthorized requests.

> 

> 

> 

> The complete error-message of the request

> {myserver}/restxq/entries?limit=50&offset=20 is:

> 

> 

> 

> <html>

> 

>     <head>

> 

>         <meta http-equiv="Content-Type" content="text/html;

> charset=ISO-8859-1"/>

> 

>         <title>Error 405 HTTP method GET is not supported by this

> URL</title>

> 

>     </head>

> 

>     <body>

> 

>         <h2>HTTP ERROR 405</h2>

> 

>         <p>Problem accessing /exist/restxq/entries. Reason:

> 

> 

> 

>             <pre>    HTTP method GET is not supported by this URL</pre>

> 

>         </p>

> 

>         <hr />

> 

>         <i>

> 

>             <small>Powered by Jetty://</small>

> 

>         </i>

> 

>     </body>

> 

> </html>

> 

> 

> 

> So I guess, I should take a look into the jetty config? And again –

> without parameters (i.e. deleting them from my restxq-api and the

> request itself) it works fine.

> 

> 

> 

> Regards

> 

> Peter

> 

> 

> 

> 

> 

> Von: Adam Retter [[hidden email]]

> Gesendet: Montag, 6. März 2017 18:46

> An: Peter Hinkelmanns <[hidden email]>

> Cc: [hidden email]

> Betreff: Re: [Exist-open] RESTXQ Params

> 

> 

> 

> Is there any information in your restxq.log file?

> 

> 

> 

> On 6 Mar 2017 5:32 p.m., "Peter Hinkelmanns"

> <[hidden email]>

> wrote:

> 

> Dear all,

> 

> 

> 

> I’m out of ideas why my implementation of an API with RESTXQ rejects

> to work. I’m trying to use %rest:query-param to pass parameters:

> 

> 

> 

> 

> 

> (:~

> : List all entries and return them as XML.

> :)

> declare

>     %rest:GET

>     %rest:path("/entries")

>     %rest:query-param("limit", "{$limit}", 20)

>     %rest:query-param("offset", "{$offset}", 0)

>     %rest:produces("application/xml", "text/xml") function

> v1:entries($limit as xs:integer?, $offset as xs:integer?) {

> 

>             …

> 

> }

> 

> 

> 

> All requests lead to “Error 405 HTTP method GET is not supported by

> this URL”. Without the %rest:query-param this request works fine.

> 

> Could this be a problem of my server configuration? All examples

> including the one from Siegel/Retter 2015 seem to look exactly the

> same like my code snipplet above.

> 

> 

> 

> Many thanks in advance

> 

> Regards

> 

> Peter Hinkelmanns

> 

> 

> 

> 

> 

> 

> 

> 

> ----------------------------------------------------------------------

> -------- Announcing the Oxford Dictionaries API! The API offers

> world-renowned dictionary content that is easy and intuitive to

> access. Sign up for an account today to start using our lexical data

> to power your apps and projects. Get started today and enter our

> developer competition.

> http://sdm.link/oxford

> _______________________________________________

> Exist-open mailing list

> [hidden email]

> https://lists.sourceforge.net/lists/listinfo/exist-open

 

 

 

--

Adam Retter

 

eXist Developer

{ United Kingdom }

[hidden email]

irc://irc.freenode.net/existdb


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RESTXQ Params

Adam Retter
Okay that sounds like a bug to me, I'll take a look as soon as I can

On 7 Mar 2017 1:10 p.m., "Peter Hinkelmanns" <[hidden email]> wrote:

Dear Adam,

 

I found the sollution:

 

(:~
: List all entries and return them as XML.
:)
declare
   
%rest:GET
   
%rest:path("/entries")
   
%rest:query-param("limit", "{$limit}", '20')
   
%rest:query-param("offset", "{$offset}", '0')
   
%rest:produces("application/xml", "text/xml")
function v1:entries($limit as xs:string*,$offset as xs:string*) {
   
(: Should be passed by parameters  :)
   
let $limit := xs:integer($limit[1])
   
let $offset := xs:integer($offset[1])

                […]

};

 

I tried to pass $limit and $offset as integers (v1:entries($limit as xs:integer*,$offset as xs:integer*)). This simply does not work, so I added the type cast in the function. Works like a charm!

 

Thanks again for your support!

 

Regards

Peter

 

 

-----Ursprüngliche Nachricht-----
Von: Adam Retter [mailto:[hidden email]]
Gesendet: Dienstag, 7. März 2017 11:04
An: Peter Hinkelmanns <[hidden email]>
Cc: [hidden email]
Betreff: Re: [Exist-open] RESTXQ Params

 

I doubt a problem with Jetty.

 

What happens if you tail the restxq.log, and then modify your query and hit save?

 

On 7 March 2017 at 08:34, Peter Hinkelmanns <[hidden email]> wrote:

> Dear Adam,

> 

> 

> 

> thank you for your feedback!

> 

> 

> 

> The last statements of restxq.log look like this:

> 

> 

> 

> 2017-02-23 10:21:45,669 [main] INFO 

> (RestXqServiceRegistryManager.java

> [getRegistry]:67) - RESTXQ is ready.

> 

> 2017-03-07 09:15:45,865 [eXistThread-17271] INFO

> (AbstractExistHttpServlet.java [getOrCreateBrokerPool]:96) - Database

> already started. Skipping configuration ...

> 

> 2017-03-07 09:15:45,883 [eXistThread-17271] INFO

> (AbstractExistHttpServlet.java [doGeneralExistServletConfig]:198) -

> Using default user guest for all unauthorized requests.

> 

> 

> 

> The complete error-message of the request

> {myserver}/restxq/entries?limit=50&offset=20 is:

> 

> 

> 

> <html>

> 

>     <head>

> 

>         <meta http-equiv="Content-Type" content="text/html;

> charset=ISO-8859-1"/>

> 

>         <title>Error 405 HTTP method GET is not supported by this

> URL</title>

> 

>     </head>

> 

>     <body>

> 

>         <h2>HTTP ERROR 405</h2>

> 

>         <p>Problem accessing /exist/restxq/entries. Reason:

> 

> 

> 

>             <pre>    HTTP method GET is not supported by this URL</pre>

> 

>         </p>

> 

>         <hr />

> 

>         <i>

> 

>             <small>Powered by Jetty://</small>

> 

>         </i>

> 

>     </body>

> 

> </html>

> 

> 

> 

> So I guess, I should take a look into the jetty config? And again –

> without parameters (i.e. deleting them from my restxq-api and the

> request itself) it works fine.

> 

> 

> 

> Regards

> 

> Peter

> 

> 

> 

> 

> 

> Von: Adam Retter [[hidden email]]

> Gesendet: Montag, 6. März 2017 18:46

> An: Peter Hinkelmanns <[hidden email]>

> Cc: [hidden email]

> Betreff: Re: [Exist-open] RESTXQ Params

> 

> 

> 

> Is there any information in your restxq.log file?

> 

> 

> 

> On 6 Mar 2017 5:32 p.m., "Peter Hinkelmanns"

> <[hidden email]>

> wrote:

> 

> Dear all,

> 

> 

> 

> I’m out of ideas why my implementation of an API with RESTXQ rejects

> to work. I’m trying to use %rest:query-param to pass parameters:

> 

> 

> 

> 

> 

> (:~

> : List all entries and return them as XML.

> :)

> declare

>     %rest:GET

>     %rest:path("/entries")

>     %rest:query-param("limit", "{$limit}", 20)

>     %rest:query-param("offset", "{$offset}", 0)

>     %rest:produces("application/xml", "text/xml") function

> v1:entries($limit as xs:integer?, $offset as xs:integer?) {

> 

>             …

> 

> }

> 

> 

> 

> All requests lead to “Error 405 HTTP method GET is not supported by

> this URL”. Without the %rest:query-param this request works fine.

> 

> Could this be a problem of my server configuration? All examples

> including the one from Siegel/Retter 2015 seem to look exactly the

> same like my code snipplet above.

> 

> 

> 

> Many thanks in advance

> 

> Regards

> 

> Peter Hinkelmanns

> 

> 

> 

> 

> 

> 

> 

> 

> ----------------------------------------------------------------------

> -------- Announcing the Oxford Dictionaries API! The API offers

> world-renowned dictionary content that is easy and intuitive to

> access. Sign up for an account today to start using our lexical data

> to power your apps and projects. Get started today and enter our

> developer competition.

> http://sdm.link/oxford

> _______________________________________________

> Exist-open mailing list

> [hidden email]

> https://lists.sourceforge.net/lists/listinfo/exist-open

 

 

 

--

Adam Retter

 

eXist Developer

{ United Kingdom }

[hidden email]

irc://irc.freenode.net/existdb


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Loading...