Four Square API use of section in query in R - r

Defining x, y, and z as "10013","XXXX","20170104" and using
w <- paste("https://api.foursquare.com/v2/venues/search?near=",x,"&section='food'&oauth_token=",y,"&v=",z,sep="")
u <- getURL(w)
test <- RJSONIO::fromJSON(u)
does not return a good result, but if I replace section='food' with query='food' it will search for food in the name of the location
(I replaced the authorization token with XXXX here).

The venues/search endpoint you're using doesn't have a section parameter. The section parameter is valid with the venues/explore endpoint if that's what you mean to be trying -> https://api.foursquare.com/v2/venues/explore
Note that /search and /explore are designed to accomplish very different things and you should read the docs before you just switch over.
/explore should be used to return recommended venues near a location. (example: coffee shop)
/search should be used to return a specific venue or venues near a location. (example: Starbucks)

Related

Responsys: Create a tracked link with dynamic path

I am looking to create a dynamic/tracked link from a supplementary tabled based on product ID.
The URL format is:
https: // site.com/product/{$id}
Using the ${clickthrough('my_products',table.id)} method hasn't worked. The resulting URL, while tracked doesn't transform the ID parameter and results in a broken link.
Would like to know, what the clickthrough function should be and what to include in the link table.
Thanks,
Your URL format needs to be updated to:
https : //site.com/product/${id}
Then you need to add the parameter table.id to pass through to id (RI will recognize id as table.id most of the time, so this is unnecessary unless you're coding the URL in a <#data> loop where the field is aliased):
${clickthrough('my_products', 'id=' + table.id)}
Or you could just change ${id} to ${table.id} to call the field in directly so you don't have to code the parameter in the clickthrough:
https : //site.com/product/${table.id}
${clickthrough('my_products')}

Google Maps API queryautocomplete location parameter doesn't work

I'm trying to use "location" parameter for queryautocomplete command in Google Maps API. But whatever coordinates I give, it returns the same results. I just need to get search suggestions of places nearby the location coordinates. Here is query example:
https://maps.googleapis.com/maps/api/place/queryautocomplete/json?input=%D0%BF%D1%80%D0%BE%D1%81%D0%BF%D0%B5%D0%BA%D1%82&key=*******&location=53.2415041,50.22124629999996&language=ru
**** is key ID
Does anybody know how to solve it?
дружба
define a radius too.
Currently you get a place in moskow as first result, although the location is in samara(but the returned places are more prominent , e.g. mir prospect in moscow)
Sample request with radius a radius of 50km:
https://maps.googleapis.com/maps/api/place/queryautocomplete/json?input=%D0%BF%D1%80%D0%BE%D1%81%D0%BF%D0%B5%D0%BA%D1%82&location=53.2415041,50.22124629999996&radius=50000&key=yourkey
First result: lenin prospect, samara

how do you send params to template

I'm trying to setup a simple messaging system between two users, x and y.
x views domain.com/user/:_id (where_id is user y)
x clicks message
x goes to domain.com/message/:_id (where _id is for the message thread if exists in messageCollection - query where to:user y's id and from:user x's id)
else
x goes to domain.com/message/newMessage
the newMessage is where I would like to pass user y's id, but preferable without a url param.
Is this possible through iron-router? Also, would this be the best design to do something like a private message in meteor.
Thanks
You can use a global variable for this. For example, before you route the user to the newMessage-page, set newMessageReceiverId = 'user_y_id'. I don't think Iron-Router has support for this ( I can't see the reason you want to avoid it).

Acquired the building name using GPS Coordinates

I am writing an app to use GPS coordinates obtained by the cell phone itself to retrieve the building name of that location.
For example, if I use this http URL to request with Google Place API:
https://maps.googleapis.com/maps/api/place/search/json?location=40.805112,-73.960349&radius=10&sensor=false&key="YourKey"
I can only get the street name of this coordinate through this.
But if I type "40.805112,-73.960349" in maps.google.com. I can get the exact building name. SO I was wondering how can I use Google Map API to obtain the building name I want.
Thank you very much about this!!!
The first result in the request you provided contains "name" : "Church of Notre Dame", isn't this what you are looking for?
A better request if you are only interested in the place name at this location would be to use the rankby=distance parameter instead or radius and to filter by type=establishment:
https://maps.googleapis.com/maps/api/place/search/json?location=40.805112,-73.960349&rankby=distance&types=establishment&sensor=false&key=YOUR_API_KEY
This would return the closest place at the given location.

StructureGroup Details using the Content Delivery/Broker API

I am trying to get all the structure groups published in a given publication using the PublicationID. I am expecting to get the structure groups with StructureGroupCriteria by passing the Root Structure Group TCM ID but getting page ids (I am expecting SGs).
Now I am trying to loop through the list and get details of each structuregroup. I did not find any API (.net) to get these details and also the API is returning only Pages.
What I have done and working so far using StructureGroupCriteria, returns list of Page IDs instead of SG IDs
PublicationCriteria pubCriteria = new PublicationCriteria(pubID);
// Root StructureGroup TCM ID -- tcm:45-3-4
StructureGroupCriteria sgCriteria = new StructureGroupCriteria("tcm:45-3-4", true);
Criteria allSGsInPub = CriteriaFactory.And(pubCriteria, sgCriteria);
Query allSGs = new Query(allSGsInPub);
string[] sgInfo = allSGs.ExecuteQuery();
Response.Write("Total : " + sgInfo.Length);
foreach (string sgid in sgInfo ) {
// HOW DO I get the Structure Group Details here
//TCMURI sgURI = new TCMURI(sgid);
}
Q # 1 : How to get the all the structuregroups and individual structure group details? (May be something simple, I am not able to find right API).
Q # 2 : How can I get all the structuregroups using ItemTypeCriteria sgCriteria = new ItemTypeCriteria(4); // 4 is SG Item Type .
When I tried this option, the query worked successfully but no results returned. Is this the expected behavior and should we always use StructureGroupCriteria instead of ItemTypeCriteria?
The reason for this approach, I want to avoid using the Root StructureGroup ID which is required with the above code. But at the moment, none of the approaches returning StructureGroup information and I always get Page Information.
Tridion Version: 2011 SP1, .net API.
Note: When I publish I am checking the publish SG info checkbox and published successfully. On Broker DB side, I can see the information on the taxnonomy table as well.
I was playing with Odata service and accidentally I found that I can get all my structure group information from Odata web service.
/cd_webservice/odata.svc/StructureGroups?$filter=PublicationId%20eq%2045
Also, the results are returning child structure groups with a depth parameter.
Just to clarify , using Broker API it is not feasible to get the structure groups (my original question). However, the workaround solution is to use OData Service to get the Structure Groups.
I don't think you will get Structure Groups returned by the Query object.
According to the documentation, when you publish Structure Group information the Structure Group hierarchy is published to the Content Delivery side where it is stored as a taxonomy.
Have you tried using the Taxonomy APIs to get the information you need?

Resources