Trouble creating/reading app-specific entity

2 views
Skip to first unread message

David

unread,
Jan 17, 2010, 12:30:44 PM1/17/10
to GeoAPI
Ok I'm a newbie to GeoAPI. Writing some Ruby code to create and read
app-specific entities. Upon POSTing this string:

'{ "name": "david point", "geom": {"type": "Point", "coordinates":
[-77.119752, 38.961881]}}'

to:

http://geoapi.com/v1/e/user-myapikey-myuniquestring?apikey=myapikey

I receive this response with an HTTPOK (200) header

{"query": {"type": "entity", "params": {"guid": "user-myapikey-
myuniquestring", "show-geom": "all"}}, "result": {"name": "david
point", "views": ["weather", "foursquare", "twitter", "flickr",
"youtube"], "userviews": [], "shorturl": "http://geo.am/rt5utk",
"geom": {"type": "Point", "coordinates": [-77.119752, 38.961881]},
"type": "user-entity"}}

So I first need to know if this response is definitively an indication
that GeoAPI has successfully created my entity?

Now I want to view this entity to get warm fuzzies, so I would like to
do that in the browser since I don't yet have fully tested custom code
to read entities programmatically. My understanding is that to view
this app-specific entity I could go to the shorturl that it gave me
above, e.g. http://geo.am/rt5utk. When I put that in the browser, it
redirects me to http://api.geoapi.com/e/user-myapikey-myuniquestring,
which I count as a good sign, however, I get a 404 error.

Then I also tried this url: http://api.geoapi.com/v1/e/user-myapikey-myuniquestring,
which it seems from the docs is another way to see the entity, however
that gives me a 404 too.

Can anyone assist? Thanks!

David

unread,
Jan 17, 2010, 1:07:49 PM1/17/10
to GeoAPI
Follow-up to my post. I have since crafted the following search query
in a url and confirmed that my app-specific entity does exist in the
database:

http://api.geoapi.com/v1/search?lat=38.961881&lon=-77.119752&radius=0.1km&apikey=demo&pretty=1&type=user-entity

However I'm still not clear on why the shorturl above in my original
post returns a 404.

Thanks,
David


On Jan 17, 12:30 pm, David <swearinge...@gmail.com> wrote:
> Ok I'm a newbie to GeoAPI.  Writing some Ruby code to create and read
> app-specific entities.  Upon POSTing this string:
>
> '{ "name": "david point", "geom": {"type": "Point", "coordinates":
> [-77.119752, 38.961881]}}'
>
> to:
>
> http://geoapi.com/v1/e/user-myapikey-myuniquestring?apikey=myapikey
>
> I receive this response with an HTTPOK (200) header
>
> {"query": {"type": "entity", "params": {"guid": "user-myapikey-
> myuniquestring", "show-geom": "all"}}, "result": {"name": "david
> point", "views": ["weather", "foursquare", "twitter", "flickr",
> "youtube"], "userviews": [], "shorturl": "http://geo.am/rt5utk",
> "geom": {"type": "Point", "coordinates": [-77.119752, 38.961881]},
> "type": "user-entity"}}
>
> So I first need to know if this response is definitively an indication
> that GeoAPI has successfully created my entity?
>
> Now I want to view this entity to get warm fuzzies, so I would like to
> do that in the browser since I don't yet have fully tested custom code
> to read entities programmatically.  My understanding is that to view
> this app-specific entity I could go to the shorturl that it gave me
> above, e.g.  http://geo.am/rt5utk.  When I put that in the browser, it

> redirects me tohttp://api.geoapi.com/e/user-myapikey-myuniquestring,

Tom Wuttke

unread,
Jan 17, 2010, 1:10:27 PM1/17/10
to geo...@googlegroups.com
On Sun, Jan 17, 2010 at 9:30 AM, David <sweari...@gmail.com> wrote:
Ok I'm a newbie to GeoAPI.  Writing some Ruby code to create and read
app-specific entities.  Upon POSTing this string:

'{ "name": "david point", "geom": {"type": "Point", "coordinates":
[-77.119752, 38.961881]}}'

to:

http://geoapi.com/v1/e/user-myapikey-myuniquestring?apikey=myapikey

I receive this response with an HTTPOK (200) header

{"query": {"type": "entity", "params": {"guid": "user-myapikey-
myuniquestring", "show-geom": "all"}}, "result": {"name": "david
point", "views": ["weather", "foursquare", "twitter", "flickr",
"youtube"], "userviews": [], "shorturl": "http://geo.am/rt5utk",
"geom": {"type": "Point", "coordinates": [-77.119752, 38.961881]},
"type": "user-entity"}}

So I first need to know if this response is definitively an indication
that GeoAPI has successfully created my entity?

yes it is.
 

Now I want to view this entity to get warm fuzzies, so I would like to
do that in the browser since I don't yet have fully tested custom code
to read entities programmatically.  My understanding is that to view
this app-specific entity I could go to the shorturl that it gave me
above, e.g.  http://geo.am/rt5utk.  When I put that in the browser, it
redirects me to http://api.geoapi.com/e/user-myapikey-myuniquestring,
which I count as a good sign, however, I get a 404 error.

That's because we don't have publicly viewable place pages for user entities yet.  they probably should not be generating shorturls until we have place pages, as this adds confusion.  I'll make a note to update the docs soon. 
 

Then I also tried this url: http://api.geoapi.com/v1/e/user-myapikey-myuniquestring,
which it seems from the docs is another way to see the entity, however
that gives me a 404 too.

This one should work.  But you need your apikey for that url.  Wait, I see you just responded and figured that out.
 

Can anyone assist?  Thanks!

Hope that helps - Tom 

David

unread,
Jan 17, 2010, 1:44:31 PM1/17/10
to GeoAPI
Thanks Tom.

On Jan 17, 1:10 pm, Tom Wuttke <tomwut...@gmail.com> wrote:


> On Sun, Jan 17, 2010 at 9:30 AM, David <swearinge...@gmail.com> wrote:
> > Ok I'm a newbie to GeoAPI.  Writing some Ruby code to create and read
> > app-specific entities.  Upon POSTing this string:
>
> > '{ "name": "david point", "geom": {"type": "Point", "coordinates":
> > [-77.119752, 38.961881]}}'
>
> > to:
>
> >http://geoapi.com/v1/e/user-myapikey-myuniquestring?apikey=myapikey
>
> > I receive this response with an HTTPOK (200) header
>
> > {"query": {"type": "entity", "params": {"guid": "user-myapikey-
> > myuniquestring", "show-geom": "all"}}, "result": {"name": "david
> > point", "views": ["weather", "foursquare", "twitter", "flickr",
> > "youtube"], "userviews": [], "shorturl": "http://geo.am/rt5utk",
> > "geom": {"type": "Point", "coordinates": [-77.119752, 38.961881]},
> > "type": "user-entity"}}
>
> > So I first need to know if this response is definitively an indication
> > that GeoAPI has successfully created my entity?
>
> yes it is.
>
>
>
> > Now I want to view this entity to get warm fuzzies, so I would like to
> > do that in the browser since I don't yet have fully tested custom code
> > to read entities programmatically.  My understanding is that to view
> > this app-specific entity I could go to the shorturl that it gave me
> > above, e.g.  http://geo.am/rt5utk.  When I put that in the browser, it

> > redirects me tohttp://api.geoapi.com/e/user-myapikey-myuniquestring,

David

unread,
Jan 17, 2010, 2:30:34 PM1/17/10
to GeoAPI
So now that I know I'm successfully creating my own app-specific
entities, how do I do a radius search that returns just MY entities?
I understand the Simple Search but the API says that "Entities can
only be constrained by type" which I suppose means I cannot constrain
results to just those I created.

Thanks,
David


On Jan 17, 1:10 pm, Tom Wuttke <tomwut...@gmail.com> wrote:

> On Sun, Jan 17, 2010 at 9:30 AM, David <swearinge...@gmail.com> wrote:
> > Ok I'm a newbie to GeoAPI.  Writing some Ruby code to create and read
> > app-specific entities.  Upon POSTing this string:
>
> > '{ "name": "david point", "geom": {"type": "Point", "coordinates":
> > [-77.119752, 38.961881]}}'
>
> > to:
>
> >http://geoapi.com/v1/e/user-myapikey-myuniquestring?apikey=myapikey
>
> > I receive this response with an HTTPOK (200) header
>
> > {"query": {"type": "entity", "params": {"guid": "user-myapikey-
> > myuniquestring", "show-geom": "all"}}, "result": {"name": "david
> > point", "views": ["weather", "foursquare", "twitter", "flickr",
> > "youtube"], "userviews": [], "shorturl": "http://geo.am/rt5utk",
> > "geom": {"type": "Point", "coordinates": [-77.119752, 38.961881]},
> > "type": "user-entity"}}
>
> > So I first need to know if this response is definitively an indication
> > that GeoAPI has successfully created my entity?
>
> yes it is.
>
>
>
> > Now I want to view this entity to get warm fuzzies, so I would like to
> > do that in the browser since I don't yet have fully tested custom code
> > to read entities programmatically.  My understanding is that to view
> > this app-specific entity I could go to the shorturl that it gave me
> > above, e.g.  http://geo.am/rt5utk.  When I put that in the browser, it

> > redirects me tohttp://api.geoapi.com/e/user-myapikey-myuniquestring,

Tom Wuttke

unread,
Jan 17, 2010, 2:42:54 PM1/17/10
to geo...@googlegroups.com
I'm not the best person to answer this one, but if nothing else I believe you can use the mql style point-radius search


to constrain on user-defined parameters that have been "indexed' 


So you may need to add a property that will uniquely define your user views and constrain on that.  Unfortunately, I don't have a concrete example for you, nor have I worked with this directly, I'm just giving you quick ideas.  If someone else knows the exact answer, please follow up. 

- Tom

David

unread,
Jan 17, 2010, 3:05:09 PM1/17/10
to GeoAPI
That sounds helpful. The User Views docs say that Views can be used
to annotate any GeoAPI entity, but I wasn't certain that app-specific
data is included in that statement. I will try.

Thanks again,
DAvid


On Jan 17, 2:42 pm, Tom Wuttke <tomwut...@gmail.com> wrote:
> I'm not the best person to answer this one, but if nothing else I believe
> you can use the mql style point-radius search
>
> http://docs.geoapi.com/MQL-Search
>
> to constrain on user-defined parameters that have been "indexed'
>
> http://docs.geoapi.com/User-Views#Indexing
>
> So you may need to add a property that will uniquely define your user views
> and constrain on that.  Unfortunately, I don't have a concrete example for
> you, nor have I worked with this directly, I'm just giving you quick ideas.
>  If someone else knows the exact answer, please follow up.
>
> - Tom

> <http://docs.geoapi.com/User-Views#Indexing>

George J. Lee

unread,
Jan 18, 2010, 11:24:43 PM1/18/10
to geo...@googlegroups.com
If you constrain your results to type "user-entity", you will only get
entities you created using your API key.
Example: http://api.geoapi.com/v1/search?lat=37.75647&lon=-122.421218&radius=0.1km&apikey=demo&pretty=1&type=user-entity

George

David Swearingen

unread,
Jan 20, 2010, 9:39:34 PM1/20/10
to geo...@googlegroups.com
Thanks George!

I got past that error. I am now I think very close but not quite there, if you don't mind checking this thread:

http://groups.google.com/group/geoapi/browse_thread/thread/f7bd1c24178cc51e

Great service!

DAvid

Reply all
Reply to author
Forward
0 new messages