talk@lists.collectionspace.org

WE HAVE SUNSET THIS LISTSERV - Join us at collectionspace@lyrasislists.org

View all threads

Re: [Talk] Common Services Advanced Search using Timestamps fails [SOLVED]

YN
Yousuf Nejati
Fri, Oct 21, 2016 11:48 PM

Turns out it has to do with both the URL encoding and the lack of quotes
around the host and query url. The correct form is:

curl -X GET
http://core.collectionspace.org/cspace-services/collectionobjects?kw=&as=%28+%28collectionspace_core%3AupdatedAt+%3E%3D++TIMESTAMP+%272016-09-24T17%3A00%3A00%27+AND+collectionspace_core%3AupdatedAt+%3C%3D++TIMESTAMP+%272016-10-21T17%3A00%3A00%27%29+%29&pgSz=10&showRelations=true&wf_deleted=false
-i -u admin@core.collectionspace.org:Administrator -H 'Content-Type:
application/xml'

It helps to check the localhost_access logs in order to come to this
solution

Thanks Richard!

I've added this to the forum for future reference.

Thanks,

-Yousuf

On Fri, Oct 21, 2016 at 2:57 PM, Yousuf Nejati <
yousuf.nejati@granitehorizon.com> wrote:

Hi all,

I'm attempting to obtain recently updated records using the Common
Services API:
https://wiki.collectionspace.org/display/collectionspace/
Common+Services+REST+API+documentation#CommonServicesRESTAPIdocumenta
tion-AdvancedSearchforobject/procedure/recordinstances

curl -X GET http://core.collectionspace.org/cspace-services/
collectionobjects?as=collectionspace_core%3AupdatedAt >%3D TIMESTAMP
%222016-10-21T00:00:00%22 AND collectionspace_core%3AupdatedAt <%3D
TIMESTAMP %222016-10-21T23:59:59%22 -i -u admin@core.collectionspace.org:Administrator
-H 'Content-Type: application/xml'

non encoded query: ?as=collectionspace_core:updatedAt >= TIMESTAMP
"2016-10-21T00:00:00" AND collectionspace_core:updatedAt <= TIMESTAMP
"2016-10-21T23:59:59"

Which returns:

curl: (6) Could not resolve host: TIMESTAMP
curl: (6) Could not resolve host: %222016-10-21T00:00
curl: (6) Could not resolve host: AND
curl: (6) Could not resolve host: collectionspace_core%3AupdatedAt
curl: (6) Could not resolve host: TIMESTAMP
curl: (6) Could not resolve host: %222016-10-21T23:59:59%22

Any ideas?

I've posted my question to  https://wiki.collectionspace.
org/questions/164561615/common-services-advanced-
search-using-timestamps-fails.

https://wiki.collectionspace.org/questions

Please feel free to respond there as well.

Much appreciated,

Yousuf

--
Yousuf Nejati

  • Junior Software Developer*
    Granite Horizon
    Web Design and Development | Enterprise Content Management | IT Consulting

yousuf.nejati@granitehorizon.com greg@granitehorizon.com
granitehorizon.com
(888) 354-6626 x786 <%28888%29%20354-6626%20x730> | (916) 647-6350 x786
<%28916%29%20647-6350%20x730> | (866) 867-7126 (fax)
8153 Elk Grove Boulevard Suite 20
Elk Grove CA 95758-5965

--
Yousuf Nejati

  • Junior Software Developer*
    Granite Horizon
    Web Design and Development | Enterprise Content Management | IT Consulting

yousuf.nejati@granitehorizon.com greg@granitehorizon.com
granitehorizon.com
(888) 354-6626 x786 <%28888%29%20354-6626%20x730> | (916) 647-6350 x786
<%28916%29%20647-6350%20x730> | (866) 867-7126 (fax)
8153 Elk Grove Boulevard Suite 20
Elk Grove CA 95758-5965

Turns out it has to do with both the URL encoding and the lack of quotes around the host and query url. The correct form is: curl -X GET http://core.collectionspace.org/cspace-services/collectionobjects?kw=&as=%28+%28collectionspace_core%3AupdatedAt+%3E%3D++TIMESTAMP+%272016-09-24T17%3A00%3A00%27+AND+collectionspace_core%3AupdatedAt+%3C%3D++TIMESTAMP+%272016-10-21T17%3A00%3A00%27%29+%29&pgSz=10&showRelations=true&wf_deleted=false -i -u admin@core.collectionspace.org:Administrator -H 'Content-Type: application/xml' It helps to check the localhost_access logs in order to come to this solution Thanks Richard! I've added this to the forum for future reference. Thanks, -Yousuf On Fri, Oct 21, 2016 at 2:57 PM, Yousuf Nejati < yousuf.nejati@granitehorizon.com> wrote: > Hi all, > > I'm attempting to obtain recently updated records using the Common > Services API: > https://wiki.collectionspace.org/display/collectionspace/ > Common+Services+REST+API+documentation#CommonServicesRESTAPIdocumenta > tion-AdvancedSearchforobject/procedure/recordinstances > > curl -X GET http://core.collectionspace.org/cspace-services/ > collectionobjects?as=collectionspace_core%3AupdatedAt >%3D TIMESTAMP > %222016-10-21T00:00:00%22 AND collectionspace_core%3AupdatedAt <%3D > TIMESTAMP %222016-10-21T23:59:59%22 -i -u admin@core.collectionspace.org:Administrator > -H 'Content-Type: application/xml' > > non encoded query: ?as=collectionspace_core:updatedAt >= TIMESTAMP > "2016-10-21T00:00:00" AND collectionspace_core:updatedAt <= TIMESTAMP > "2016-10-21T23:59:59" > > Which returns: > > curl: (6) Could not resolve host: TIMESTAMP > curl: (6) Could not resolve host: %222016-10-21T00:00 > curl: (6) Could not resolve host: AND > curl: (6) Could not resolve host: collectionspace_core%3AupdatedAt > curl: (6) Could not resolve host: TIMESTAMP > curl: (6) Could not resolve host: %222016-10-21T23:59:59%22 > > Any ideas? > > I've posted my question to https://wiki.collectionspace. > org/questions/164561615/common-services-advanced- > search-using-timestamps-fails. > > https://wiki.collectionspace.org/questions > > Please feel free to respond there as well. > > Much appreciated, > > Yousuf > > > > > -- > Yousuf Nejati > * Junior Software Developer* > Granite Horizon > Web Design and Development | Enterprise Content Management | IT Consulting > > yousuf.nejati@granitehorizon.com <greg@granitehorizon.com> > granitehorizon.com > (888) 354-6626 x786 <%28888%29%20354-6626%20x730> | (916) 647-6350 x786 > <%28916%29%20647-6350%20x730> | (866) 867-7126 (fax) > 8153 Elk Grove Boulevard Suite 20 > Elk Grove CA 95758-5965 > -- Yousuf Nejati * Junior Software Developer* Granite Horizon Web Design and Development | Enterprise Content Management | IT Consulting yousuf.nejati@granitehorizon.com <greg@granitehorizon.com> granitehorizon.com (888) 354-6626 x786 <%28888%29%20354-6626%20x730> | (916) 647-6350 x786 <%28916%29%20647-6350%20x730> | (866) 867-7126 (fax) 8153 Elk Grove Boulevard Suite 20 Elk Grove CA 95758-5965