update it was a bug and they fixed it!
Dutch postalcodes contains 4 digits and 2 letters.
When entering 4 digits, it finds the global postalcode location, but when you add 2 letters (which corresponds to a street) the response doenst return the right location.
For example: 1012 returns a general postalcode location in Amsterdam. But when you enter 1012 AW it returns totally different results (different cities even). But it should return a specific location within the 1012 postalcode area.
url
https://api.mapbox.com/geocoding/v5/mapbox.places/${search}.json
params
{
language: 'nl',
country: 'NL',
limit: 1,
access_token: config.accessToken,
types: 'address,place,poi'
}
The postal code that comes back don't have the two letter digits. How to get Mapbox to add the two letters?
Example response.
It is 4694 but it should be 4694EG
{
"type":"FeatureCollection",
"query":[
"***",
"***"
],
"features":[
{
"id":"address.7144861498943104",
"type":"Feature",
"place_type":[
"address"
],
"relevance":0.75,
"properties":{
"accuracy":"point"
},
"text_nl":"Beatrixlaan",
"place_name_nl":"Beatrixlaan 2, 4694 Scherpenisse, Nederland",
"text":"Beatrixlaan",
"place_name":"Beatrixlaan 2, 4694 Scherpenisse, Nederland",
"center":[
4.103576,
51.546267
],
"geometry":{
"type":"Point",
"coordinates":[
4.103576,
51.546267
]
},
"address":"2",
"context":[
{
"id":"postcode.10605073597498580",
"text_nl":"4694",
"text":"4694"
},
{
"id":"place.5585596482812836",
"wikidata":"Q2381830",
"text_nl":"Scherpenisse",
"language_nl":"nl",
"text":"Scherpenisse",
"language":"nl"
},
{
"id":"region.13950781060383020",
"short_code":"NL-ZE",
"wikidata":"Q705",
"text_nl":"Zeeland",
"language_nl":"nl",
"text":"Zeeland",
"language":"nl"
},
{
"id":"country.9349515904622050",
"short_code":"nl",
"wikidata":"Q55",
"text_nl":"Nederland",
"language_nl":"nl",
"text":"Nederland",
"language":"nl"
}
]
}
],
"attribution":"NOTICE: © 2019 Mapbox and its suppliers. All rights reserved. Use of this data is subject to the Mapbox Terms of Service (https://www.mapbox.com/about/maps/). This response and the information it contains may not be retained. POI(s) provided by Foursquare."
}
Related
I am trying to create a custom control in Angular on the Map. The control will display a button on top of a Map and when user drops the mouse anywhere in map, if the street side exists for that coordinate on map, then street view should be loaded.
Otherwise the user should be prompted a message that "No street side exists for the chosen point"
How can check that street side exists or not using Bing Maps API.
Take a look at the following REST API:
https://learn.microsoft.com/en-us/bingmaps/rest-services/imagery/get-imagery-metadata
Specifically, you can request the Streetside Imagery metadata to determine the availability of Streetside at a location at a specified zoom level (and the vintage of said imagery):
https://dev.virtualearth.net/REST/v1/Imagery/Metadata/{imagerySet}/{centerPoint}?orientation={orientation}&zoomLevel={zoomLevel}&include={ImageryProviders}&key={BingMapsAPIKey}
From the examples:
http://dev.virtualearth.net/REST/v1/Imagery/MetaData/Streetside/47.668687,-122.384795?key={BingMapsAPIKey}
This returns the following info:
{
"authenticationResultCode": "ValidCredentials",
"brandLogoUri": "http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png",
"copyright": "Copyright © 2019 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.",
"resourceSets": [
{
"estimatedTotal": 1,
"resources": [
{
"__type": "StreetsideMetadata:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1",
"imageHeight": 256,
"imageUrl": "http:\/\/ecn.{subdomain}.tiles.virtualearth.net\/tiles\/hs0203232101212100{faceId}{tileId}?g=7467&key=AmXtaLCMP57QEyxyjkcduZRBnG2QsKlj-iI5ng6neAGhOFP1md5I_S6iJzyO8GcF",
"imageUrlSubdomains": [
"t0",
"t1",
"t2",
"t3"
],
"imageWidth": 256,
"imageryProviders": null,
"vintageEnd": "17 Jul 2014 GMT",
"vintageStart": "17 Jul 2014 GMT",
"zoomMax": 4,
"zoomMin": 1,
"he": 52.286,
"lat": 47.668696,
"lon": -122.384813,
"pi": 0.638,
"ro": -0.326
}
]
}
],
"statusCode": 200,
"statusDescription": "OK",
"traceId": "d5b39048afed42d29841380a6f57bed1|CO0000112F|7.7.0.0"
}
I have configured multiple languages in my Dialogflow agent. I cannot figure out how to detect the language of the request in my firebase function in order to answer with the right language. Is there a standard approach to handle this? I don't see any function to detect the language in https://github.com/actions-on-google/actions-on-google-nodejs
I would expect to be able to do something like this:
const app = new DialogflowApp({request: request, response: response});
if (app.getLang == 'en') {
\\ Do something in english
}
else if (app.getLang == 'es') {
\\ Do something in spanish
}
There is a public sample on the AoG GitHub for Number Genie, which is in both French and English.
In this sample they define JSON objects for English and French locales:
{
"images": {
"cold": {
"url": "COLD.gif",
"altText": "cold genie",
"cardText": [
"Freezing like an ice cave in Antarctica?",
"I can't feel my face anymore",
"Hurry, before I turn into an icicle"
]
},
...
{
"images": {
"cold": {
"url": "COLD.gif",
"altText": "Génie froid",
"cardText": [
"Je me gèle comme un glaçon en Antartique",
"Je ne sens plus mon visage",
"Dépêchez-vous avant que je ne me transforme en glaçon"
]
},
...
Then there is a central strings.js file which will pull the correct string for that locale.
const i18n = require("i18n");
i18n.configure({
"directory": __dirname + "/locales",
"objectNotation": true,
"fallbacks": {
"fr-FR": "fr",
"fr-CA": "fr"
}
});
const prompts = () => ({
"welcome": {
"visual": {
"elements": [
[i18n.__("variants.greeting"), i18n.__("variants.invocation")],
i18n.__("variants.invocationGuess"),
i18n.__("images.intro")
],
"suggestions": onlyNumberSuggestions
}
},
...
Which is then used to map to each intent:
[Actions.GENERATE_ANSWER] () {
this.data.answer = strings.getRandomNumber(strings.numbers.min,
strings.numbers.max);
this.data.guessCount = 0;
this.data.fallbackCount = 0;
this.data.steamSoundCount = 0;
this.ask(strings.prompts.welcome, strings.numbers.min, strings.numbers.max);
}
The locale is set by getting that from the app.getUserLocale() method:
/**
* Get the Dialogflow intent and handle it using the appropriate method
*/
run () {
strings.setLocale(this.app.getUserLocale());
/** #type {*} */
const map = this;
const action = this.app.getIntent();
console.log(action);
if (!action) {
return this.app.ask(`I didn't hear a number. What's your guess?`);
}
map[action]();
}
There's definitely a lot here, and you don't need to do this exactly the same way. app.getUserLocale() should return the current locale, which you can then use in any way that you want to return the response.
Attempting to create a multi-piece shipment per https://goshippo.com/docs/multipiece
I'm specifying async = false in my request, but I'm getting back an empty rates_list in the response. EDIT to add that the to and from address I redacted are both valid (home and office) and I've been able to successfully do single-piece test shipments using them before, just not multi-piece ones.
Request payload (I apologize if these are a mess, I can't get SO to format JSON):
{
"object_purpose": "PURCHASE",
"address_from": {
"object_state":null,
"object_purpose":"PURCHASE",
"object_source":null,
"object_created":null,
"object_updated":null,
"object_owner":null,
"name":"REDACTED",
"company":"REDACTED",
"street1":"REDACTED",
"street_no":"",
"street2":"",
"city":"REDACTED",
"state":"REDACTED",
"zip":"REDACTED",
"country":"US",
"phone":"REDACTED",
"email":"REDACTED",
"ip":null,
"metadata":null,
"is_residential":null,
"validate":false,
"object_id":null,
"object":"unknown"
},
"address_to": {
"object_state":null,
"object_purpose":"PURCHASE",
"object_source":null,
"object_created":null,
"object_updated":null,
"object_owner":null,
"name":"Tony Stark",
"company":"Stark Enterprises",
"street1":"REDACTED",
"street_no":null,
"street2":"",
"city":"REDACTED",
"state":"REDACTED",
"zip":"REDACTED",
"country":"US",
"phone":null,
"email":"REDACTED",
"ip":null,
"metadata":null,
"is_residential":null,
"validate":false,
"object_id":null,
"object":"unknown"
},
"parcel": [
{
"object_state":null,
"object_created":null,
"object_updated":null,
"object_owner":null,
"length":"20",
"width":"20",
"height":"20",
"distance_unit":"in",
"weight":1.5,
"mass_unit":"lb",
"metadata":null,
"object_id":null,
"object":"unknown"
},
{
"object_state":null,
"object_created":null,
"object_updated":null,
"object_owner":null,
"length":"20",
"width":"20",
"height":"20",
"distance_unit":"in",
"weight":1.5,
"mass_unit":"lb",
"metadata":null,
"object_id":null,
"object":"unknown"
},
{
"object_state":null,
"object_created":null,
"object_updated":null,
"object_owner":null,
"length":"20",
"width":"20",
"height":"20",
"distance_unit":"in",
"weight":2.6,
"mass_unit":"lb",
"metadata":null,
"object_id":null,
"object":"unknown"
}
],
"async": false
}
Response:
`{
"async":null,
"object_state":"VALID",
"object_status":"SUCCESS",
"object_purpose":"PURCHASE",
"object_created":"2016-12-13T20:33:20.318Z",
"object_updated":"2016-12-13T20:33:20.318Z",
"object_owner":"REDACTED",
"address_from":"e0633e8c3f3a4a19ba6a83998906da02",
"address_to":"b48de7caf2624803adba6cac2b10e1f5",
"address_return":"e0633e8c3f3a4a19ba6a83998906da02",
"parcel":[
"ec25a9566fdd47ef9d728307b76eca35",
"be5e95a487644abd875f6049a32621fc",
"de942d19ef8046e49011c3b1971c2dc8"
],
"submission_type":"PICKUP",
"submission_date":"2016-12-13T15:33:18Z",
"insurance_amount":"0.0",
"insurance_currency":"USD",
"extra":{
},
"customs_declaration":null,
"reference_1":"",
"reference_2":"",
"rates_url":"https://api.goshippo.com/shipments/4f1e4a275ca341dda8cb31eed746720f/rates/",
"rates_list":[
],
"metadata":"",
"messages":[
],
"object_id":"4f1e4a275ca341dda8cb31eed746720f",
"object":"unknown"
}`
The rates_url similarly gives no results:
{"count": 0, "next": null, "previous": null, "results": []}
I am a support engineer here at Shippo. I looked up the API call you made to our servers and it looks like the TO and FROM addresses are the same. You're getting a blank response in return because those two fields cannot be the same, even for testing purposes. We're aware that we need to have better error messages and we're working on it. If you get any more errors or blank responses, email support#goshippo.com.
Ben
I am working on a POC involving AEM and site catalyst integration .
I am using AEM’s out of box Geomatrixx outdoors website which already implements site catalyst features.
Data is being populated to report suite via
• Data tracking (on page load)
data-tracking="{'event': ['eventName'], 'values': {'key': 'value', 'nextKey': 'nextValue'}, componentPath: 'myapp/component/mycomponent'}"
• CQ_Analytics.record(after page load, activates on a page).
CQ_Analytics.record({event: 'eventName', values: { valueName: 'VALUE' }, collect: false, options: { obj: this, defaultLinkType: 'X' }, componentPath: '<%=resource.getResourceType()%>'})
UseCase: When, I am adding a product to cart below function gets executed CQ_Analytics.record But unable to send cart addition data to site catalyst .
I have verified same using adobe digital debugger.
Code snippet from /libs/commerce/components/product/product.jsp
function trackCartAdd(form) {
if (CQ_Analytics.Sitecatalyst) {
var productQuantity = Number($("input[name='product-quantity']", form).val() || '1');
var productPrice = Number($("input[name='product-size']:checked", form).data('price').replace(/[^0-9\\.]/g, ''));
var productChildSku = $("input[name='product-size']:checked", form).data('sku')
CQ_Analytics.record({
"event": ["cartAdd"<%= (session.getCartEntryCount() == 0) ? ", 'cartOpen'" : "" %>],
"values": {
"product": [{
"category": "",
"sku": "<%= xssAPI.encodeForJSString(baseProduct.getSKU()) %>",
"price": productPrice * productQuantity,
"quantity": productQuantity,
"evars": {
"childSku": CQ.shared.Util.htmlEncode(productChildSku)
}
}]
},
"componentPath": "<%= xssAPI.encodeForJSString(resource.getResourceType()) %>"
});
}
return true;
}
Note: I have done the product variable mapping for report suite in AEM.
Please guide me .
Preface
I'm building a Drupal site that doubles as a content-serving endpoint for a mobile app written in Flex. The CMS is responsible for storing a number of items that have, among other fields, a field for an image that represents the node (like a movie cover or small product shot). I'm using the Services module and the REST service to serve this content to the mobile app as JSON.
Problem
I've noticed that Drupal (or perhaps Services itself) restricts the amount of data that comes back with each request, seemingly based on the granularity of the request. For example, a node index request returns only fields that are more or less the same for every node: nid, title, status, etc. While a request for a single node additionally returns custom fields, including my image field.
My issue is that the URI value for the image field is, "streamwrapped" (or so I've seen it referred to in researching this issue) so that it is simply listed as public://images/node_image.jpg. In order to get the full URI, I have to make a request for the file. This means that for the index page in the mobile app, I have to make 1 + (n * 2) requests just to get the full data about a given node, plus n requests to get the images for each node display. At most n will be 8 for a given page of nodes, so that means I could be making up to 25 requests to the server per page of nodes.
Is this common/accepted or is there an easier/faster/less heavy-handed way to get access to this data in fewer requests?
Side note: One thing I did notice is that the file request comes back with the image data base64-encoded. I could certainly use that to display an image, but I'd prefer to just request the binary image from the server.
Example
/end-point/node.json
[
{
nid: "6",
vid: "6",
type: "page",
language: "und",
title: "Node 6 Title",
...snip...
uri: "http://example.com/end-point/node/6"
},
{
nid: "5",
vid: "5",
type: "game",
language: "und",
title: "Node 5 Title",
...snip...
uri: "http://example.com/end-point/node/5"
},
...snip...
]
/end-point/node/5.json
{
vid: "5",
uid: "1",
title: "Node 5 Title",
...snip...
body: {
und: [{
value: "Lorem ipsum dolor sit amet.",
summary: "Lorem ipsum...",
format: "filtered_html",
safe_value: "<p>Lorem ipsum dolor sit amet.</p>",
safe_summary: "<p>Lorem ipsum...</p>"
}]
},
field_artwork: {
und: [{
fid: "8",
alt: "",
title: "",
width: "252",
height: "272",
uid: "1",
filename: "node_image.jpg",
uri: "public://images/node_image.jpg",
filemime: "image/jpeg",
filesize: "32653",
status: "1",
timestamp: "1329839925",
rdf_mapping: []
}]
},
...snip...
}
/end-point/file/8.json
{
fid: "8",
uid: "1",
filename: "node_image.jpg",
uri: "public://node_image.jpg",
filemime: "image/jpeg",
filesize: "32653",
status: "1",
timestamp: "1329839925",
rdf_mapping: [ ],
uri_full: "http://example.com/sites/default/files/images/node_image.jpg",
target_uri: "images/node_image.jpg",
file: "..snip base64-encoded image data...",
image_styles: [ ]
}
Since got no answer, I made it by myself.
The new module, Full URL file information, will fill the info you are looking for.
More details in my blog post - "Drupal file information, filling the URL information for Services".