Glympse API append_data error - glympse

I am trying to append_data to a Glympse ticket and I am getting a serialization error. I have tried many variation on the following request body and can not seem to make a successful call:
{
[
"n" : "destination",
"v" : {
"lat" : 43345678,
"lng" : -121456789
}
]
}

The timestamp field is required https://developer.glympse.com/docs/core/api/reference/tickets/id/append_data/post
[{"v":{"lng":-121456789,"lat":43345678},"t":1513869134948,"n":"destination"}]

Related

document field returns null when querying groups of Prismic Content-Realtionship fields in graphql

Issue:
I am using Prismic to send data through to my website.
In Prismic I have a Type (testimonial_list) that consists of a group of content-relation fields (Prismic Type testimonials).
To query the data on the inner Types I need to access them via the document field in graphql and use inline-fragments.
I have followed as instructed here:
https://github.com/angeloashmore/gatsby-source-prismic#Query-Content-Relation-fields
Inside graphql I have managed to navigate to the testimonial data-fields (on the document field) but the document field returns null, this is where I'm stuck. I can't work out why it would return null as the content exists and the fields are clearly being found in graphql.
Info:
My project is built using Gatsby and I'm using the plugin gatsby-source-prismic v3.1.1
Here you can see I can access the correct field data and I am getting the right number of nodes returned but document is empty:
This is the JSON for the testimonial_list Type on Prismic:
{
"Main" : {
"prismic_title" : {
"type" : "StructuredText",
"config" : {
"single" : "heading6",
"label" : "Title (only used to name entry in Prismic list)",
"placeholder" : "Prismic list title (otherwise \"undefined\")"
}
},
"page" : {
"type" : "Select",
"config" : {
"options" : [ "Homepage", "Option 2", "Option 3" ],
"label" : "Website page to appear on:"
}
},
"testimonial_list" : {
"type" : "Group",
"config" : {
"fields" : {
"testimonial" : {
"type" : "Link",
"config" : {
"select" : "document",
"customtypes" : [ "testimonial" ],
"label" : "testimonial"
}
}
},
"label" : "Testimonial List"
}
}
}
}
Thank you for any help, if there is any more info I can supply to help deduce the issue please let me know.
In the end, the issue turned out to be a typo in my gatsby-config where I was requiring the schema.
It was a daft mistake but stare at something too long and these things happen I guess.
In case anybody else has a similar issue you must ensure the property names of your Prismic schemas inside your gatsby-config are exactly the same as in Prismic.
For example if your Type in Prismic is called "my_type" then you must use that exact syntax - so for example don't use "myType".
Hey it might be something related to the gatsby-source-prismic plugin
I would directly open an issue for it here if I were you: https://github.com/angeloashmore/gatsby-source-prismic/issues

Google places API - Can I separate out the output?

Hiting the endpoint:
https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=Hoboken%20NJ&fields=formatted_address,name&inputtype=textquery&key=xxxxxxxxxxxxxxxxxxx
Getting the result:
{
"candidates" : [
{
"formatted_address" : "New Jersey, USA",
"name" : "Hoboken"
}
],
"debug_log" : {
"line" : []
},
"status" : "OK"
}
What bugs me is that I can't find a way to separate out the region and country - Yes, I know I can parse the result myself. But is there an option I get shoot out to Google Places API to have the response separate out city/state(or region)/country in the returned JSON?
Something like:
{
"candidates" : [
{
"state" : "New Jersey",
"country" : "USA",
"name" : "Hoboken"
}
],
"debug_log" : {
"line" : []
},
"status" : "OK"
}
As far as I know, it isn't possible, you'll have to parse it. Places API is designed to search businesses and POIs at first place.
Google does have, however a geocoding API which seems to give out Postal Code, Country, State, Address, separetely.
There are also some free alternatives

How to create elasticsearch watcher by xpack

I just tried working with elasticsearch and now trying to create first watcher
There are some information I have read in elasticsearch documentation : https://www.elastic.co/guide/en/x-pack/current/watcher-getting-started.html
And now I trty to create one :
https://es.origin-test.cloud.rccf.ru/apiconnect508/_xpack/watcher/watch/audit_watch
PUT method + auth headers
I put in :
{ "trigger" : {
"schedule": {
"interval": "1h"
}
}, "actions" : { "send_email" : {
"email" : {
"to" : "ext_avolkova#rencredit.ru",
"subject" : "Watcher Notification",
"body" : "{{ctx.payload.hits.total}} logs found"
} } } }
But now I see mistake :
No handler found for uri
[/apiconnect508/_xpack/watcher/watch/log_audit] and method [PUT]
Please, help me to create one simple watcher
Based on the support matrix, elasticsearch 2.x is not compatible with x-pack.
You might want to install Watcher as a separate plugin using this document.

query output to email action

I am trying to use watcher API to send alerts.
https://www.elastic.co/guide/en/elasticsearch/reference/5.5/watcher-api-put-watch.html
I am able to set an example as explained above. When I check my mail, I can see the "subject" line correctly. But I need the output of a query as body of the email.
How is this achieved using x-pack?
In the example at the documentation, it only specifies the subject.
You can see an example with body in this page:
https://www.elastic.co/guide/en/x-pack/5.5/actions-email.html
It specifies the body, and adds the response in JSON format to the attachment of the email.
...
"actions" : {
"email_administrator" : {
"email" : {
"to" : "sys.admino#host.domain",
"subject" : "Encountered {{ctx.payload.hits.total}} errors",
"body" : "Too many error in the system, see attached data",
"attachments" : {
"attached_data" : {
"data" : {
"format" : "json"
}
}
},
"priority" : "high"
}
}
]
...

Google Places API Web Service shows photo_reference, but Javascript library doesn't

I'm building a basic places search page and I'm using the Google Places Javascript library for it (text search). I do get one "photo" element back, but I noticed that the "photo_reference" field is empty. Here a sample request:
var service = new google.maps.places.PlacesService(this.map);
service.textSearch({query: 'harbour bridge'}, this.callback.bind(this));
Repsonse:
{
"formatted_address":"Sydney Harbour Bridge, Sydney NSW, Australia",
"geometry":{
"location":{
"lat":-33.8523063,
"lng":151.21078710000006
}
},
"icon":"https://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"id":"e22913360d0b946d099c7a32a77a95e49f9ead66",
"name":"Sydney Harbour Bridge",
"photos":[{
"height":4000,
"html_attributions":["Jasper Straver"],
"width":6000
}],
"place_id":"ChIJ49XqJV2uEmsRPsTAF7eOlGg",
"rating":4.7,
"reference":"[...]",
"types":["point_of_interest", "establishment"],
"html_attributions":[]
}
If I do the same request using the web service, I get the photo_reference. Example:
https://maps.googleapis.com/maps/api/place/textsearch/json?key=[...]&query=harbour%20bridge
Response:
{
"formatted_address" : "Sydney Harbour Bridge, Sydney NSW, Australia",
"geometry" : {
"location" : {
"lat" : -33.8523063,
"lng" : 151.2107871
}
},
"icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"id" : "e22913360d0b946d099c7a32a77a95e49f9ead66",
"name" : "Sydney Harbour Bridge",
"photos" : [
{
"height" : 4000,
"html_attributions" : ["\u003ca href=\"https://maps.google.com/maps/contrib/113178678511744469415/photos\"\u003eJasper Straver\u003c/a\u003e"],
"photo_reference" : "CmRdAAAAY-WUame_CRFnMFmUN4UlvFHI7o3tQOqXJxTkjQINgzMQOOheBzLPIm43dlIAIkhFyugFAw8fnf-ItEiUp1j48B23sCDFRtCWM123euhDif_P1jYkvFAjDrPxq1rCnmi2EhCt6LpVl5W-AKPLRkW_tzs6GhRlG4dx2CVuTNZZMFFo3eYMSFWzGg",
"width" : 6000
}
],
"place_id" : "ChIJ49XqJV2uEmsRPsTAF7eOlGg",
"rating" : 4.7,
"reference" : "[...]",
"types" : [ "point_of_interest", "establishment" ]
}
How come there is a difference between the JS and Web Services API? How can I get the photo_reference from the JS library? (I don't want to make a getDetails(...) request for each search result)
Thanks!
photo_reference is for the Google Places API Web Service. With the Places Javascript library you can just call getUrl on the elements of the photos array, e.g. place.photos[0].getUrl({maxWidth: 1000}).
Like the Web Service, search results won't have more than 1 photo.

Resources