I am trying to read location type data from Cloudant into Mobile App Builder (MAB). It looks like MAB is unable to parse it. If I manually create the column still is unable to match it with the data coming from Cloudant
{
"_id": "d07165c0087a05b8ae732266dc37f106",
"_rev": "8-76f0947057bf237bc897adc20f838ce9",
"Name": "Morrisville Location",
"Address": "87 Peste Drive",
"Phone": "919-278-1122",
"Email": "morrisville#store.com",
"Location": {
"Latitude": "35.808514",
"Longitude": "-78.812794"
}
}
What format should I use for location data so MAB can parse it ?
The following worked for me:
{
"_id": "d07165c0087a05b8ae732266dc37f106",
"_rev": "8-76f0947057bf237bc897adc20f838ce9",
"Name": "Morrisville Location",
"Address": "87 Peste Drive",
"Phone": "919-278-1122",
"Email": "morrisville#store.com",
"Location": {
"type": "Point",
"coordinates": [-78.812794, 35.808514]
}
}
Note: Order in coordinates array is [longitude, latitude]
Reference: https://docs.cloudant.com/geo.html and http://geojson.org/geojson-spec.html#appendix-a-geometry-examples
This very first experimental version of Mobile App Builder does not support nested objects at this time.
Here, I've removed the nested object and it works:
See:
IBM mobile app builder does not see documents in Cloudant database, why?
To answer my own question: This is not possible today given the limited parsing features of the current tool. Thanks for the comments and feedback.
Related
I have a rails application and use elastic search as a search engine in my rails app. this app collects data from the mobile application and could collect from any kind of mobile app. mobile app sends two types of data user profile details and user actions details. my app admins could search over this data with multiple conditions and operations and fetch the specific results and which are user profile details. after that my app admins could communicate with this profile, for example, send an email, SMS, or even chat online. In my case I have two options to save user data; first of all, I want to save user profiles details and user action details in a separate document with this structure profile doc:
POST profilee-2022-06-09/_doc
{
"profile": {
"app_id": "abbccddeeff",
"profile_id": "2faae1d6-5875-4b36-b119-74a14589c841",
"whatsapp_number": "whatsapp:+61478421940",
"phone": "+61478421940",
"email": "user#mail.com",
"first_name": "john",
"last_name": "doe"
}
}
user actions details:
POST events_app_id_2022-05-17/_doc
{
"app_id": "9vlgwrr6rg",
"event": "Email_Sign_Up",
"profile_id": "2faae1d6-5875-4b36-b119-74a14589c840",
"media": "x1z1",
"date_time": "2022-05-17T11:48:02.511Z",
"device_id": "2faae1d6-5875-4b36-b119-74a14589c840",
"lib": "android",
"lib_version": "1.0.0",
"os": "Android",
"os_version": "12",
"manufacturer": "Google",
"brand": "google",
"model": "sdk_gphone64_arm64",
"google_play_services": "available",
"screen_dpi": 440,
"screen_height": 2296,
"screen_width": 1080,
"app_version_string": "1.0",
"app_build_number": 1,
"has_nfc": false,
"has_telephone": true,
"carrier": "T-Mobile",
"wifi": true,
"bluetooth_version": "ble",
"session_id": "b1ad31ab-d440-435f-ac12-3d03c30ac44f",
"insert_id": "1e285b51-abcf-46ae-8359-9a9d58970cdf"
}
As I said before app admins search over this document to fetch specific profiles and use that result to communicate with them, in this case, the problem is the mobile user could create a profile and a few days or a few months later create some actions so user profile details and user action details are generated in different days so if app admins want to fetch specific result from this data and wrote some complex query I have at least two queries by application on my elastic search in my app it's impossible because each query must save for later use by admin, so As a result of business logic it's impossible to me, and I have to add in some case I need to implement join query that based on elastic search documentation It has cost so it's impossible In the second scenario I decided to save both user profile and action in one docs somethings like this:
POST profilee-2022-06-09/_doc
{
"profile": {
"app_id": "abbccddeeff",
"profile_id": "urm-2faae1d6-5875-4b36-b119-74a14589c841",
"whatsapp_number": "whatsapp:+61478421940",
"phone": "+61478421940",
"email": "user#mail.com",
"first_name": "john",
"last_name": "doe",
"events": [
{
"app_id": "abbccddeeff",
"event": "sign_in",
"profile_id": "urm-2faae1d6-5875-4b36-b119-74a14589c841",
"media": "x1z1",
"date_time": "2022-06-06T11:52:02.511Z"
},
{
"app_id": "abbccddeeff",
"event": "course_begin",
"profile_id": "urm-2faae1d6-5875-4b36-b119-74a14589c841",
"media": "x1z1",
"date_time": "2022-06-06T11:56:02.511Z"
},
{
"app_id": "abbccddeeff",
"event": "payment",
"profile_id": "urm-2faae1d6-5875-4b36-b119-74a14589c841",
"media": "x1z1",
"date_time": "2022-06-06T11:58:02.511Z"
}
]
}
}
In this case, In the same state, I have to do as same as I do in before and I have to generate a profile index per day and append user action to it, so It means I have to update continuously each day, assume I have 100,000 profile and each one have 50 actions it means 100,000 * 50 per day update that have severity on my server so still it's impossible. So Could you please help me what is the best model to save my data in elastic search based on my descriptions?
Update: Does elastic search useful for my requirements? If I switch to other databases like MongoDB or add Hadoop it be more useful in my case?
I'm developing an integration that will programmatically create product entries in Salesforce, and part of that process needs to be the addition of product images. I'm using the Connect API and am able to make a GET call to the right folder like this (I've scrambled the IDs and what not for this example):
https://example.salesforce.com/services/data/v52.0/connect/cms/delivery/channels/0591G0000000006/contents/query?folderId=9Pu1M000000fxUMSYI
That returns a payload like this:
{
"currentPageUrl": "/services/data/v52.0/connect/cms/delivery/channels/0ap1G0000000006/contents/query?page=0&pageSize=250",
"items": [
{
"contentKey": "MCZ2YVCGLNSBETNIG5P5QMIS4KNA",
"contentNodes": {
"source": {
"fileName": "PET Round.jpg",
"isExternal": false,
"mediaType": "Image",
"mimeType": "image/jpeg",
"nodeType": "MediaSource",
"referenceId": "05T0R000005MthL",
"resourceUrl": "/services/data/v52.0/connect/cms/delivery/channels/0ap1G0000000007/media/MCY2YVCGLNSBETNIG5P4QMIS4KNA/content",
"unauthenticatedUrl": "/cms/delivery/media/MCZ2YVCGLNSBETNIG5P4QMIS4KNA",
"url": "/cms/delivery/media/MCY2YVCGLNSBETNIG5P4QMIS4KNA"
},
"title": {
"nodeType": "NameField",
"value": "844333"
}
},
"contentUrlName": "844333",
"language": "en_US",
"managedContentId": "20T0R0000008U9qUAE",
"publishedDate": "2021-08-18T16:20:57.000Z",
"title": "844333",
"type": "cms_image",
"typeLabel": "Image",
"unauthenticatedUrl": "/cms/delivery/v52.0/0DB1G0000008tfOWAU/contents/20Y0R0000008y9qUAE?oid=00D0R000000OI7GUAW"
}
]
}
I am also able to retrieve images by contentKey with a GET call like this:
https://example.salesforce.com/services/data/v52.0/connect/cms/delivery/channels/0ap1G0000000007/media/MCZ2ZVCGLNSBETMIG5P4QMIS4KNA/content
Anyone know what the endpoint should look like and what parameters etc it should have? I'm having trouble finding anything for this specific scenario in the docs but surely there's a way.
Thanks!
I'd like to know whether there is a way to directly get the latitude/longitude fields via the Facebook Graph API.
The background is that I want to reduce the amount of data which is returned by the Graph API by getting rid of fields which are not of interest for my application.
I know there's something like this working in the Graph API Explorer:
me/?fields=id,checkins.fields(id,place.fields(id,location),created_time)
It returns the following:
{
"id": "12345",
"checkins": {
"data": [
{
"id": "101511234546244",
"place": {
"id": "170048419682121",
"location": {
"street": "",
"city": "Frankfurt",
"state": "",
"country": "Germany",
"zip": "",
"latitude": 50.108641831527,
"longitude": 8.6654729704433
}
},
"created_time": "2012-11-08T08:30:48+0000"
}
]
}
As I don't need the address parts of the location, I'd really like to get rid of them as well. If I try this the follwoing way, it doesn't work:
me?fields=id,checkins.fields(id,place.fields(id,location.fields(latitude,longitude)),created_time)
The result is
{
"id": "12345",
"checkins": {
"data": [
{
"id": "101511234546244",
"place": null,
"created_time": "2012-11-08T08:30:48+0000"
}
]
}
Did somebody have success in doing something similar? If so, I'd be great if you could let me know. Thanks!
According to the API documentation and the Graph API explorer, Subfields are not supported by location so you are unable to extract just latitude and longitude from the location object.
How can I (if I can) get the results of a poll/question from Facebook graph? Currently I get back something similar to what is below:
"data": [
{
"id": "12345_12345",
"from": {
"name": "My Company Name",
"category": "Category",
"id": "12345"
},
"story": "This is my question",
"icon": "https://s-static.ak.facebook.com/rsrc.php/v1/yy/r/pz5wRf7MB0H.png",
"privacy": {
"description": "Public",
"value": "EVERYONE"
},
"type": "question",
"object_id": "12345",
"application": {
"name": "Questions",
"id": "12345"
},
"created_time": "2012-04-25T12:23:03+0000",
"updated_time": "2012-04-25T12:23:03+0000",
"comments": {
"count": 0
}
}
Can I get more information back about this question? I'm currently using PHP + CURL to get the feed.
Thanks!
From the looks of it, you have queried for the specific post (post-id:12345_12345) : https://graph.facebook.com/12345_12345 .
To get to the question's data we have to query for the question id that is given in this post's data itself:
"type": "question",
"object_id": "12345",
from here we have the question's id, i.e object_id:12345. Using this id we can get the question's info, so query url is : https://graph.facebook.com/12345.
In the question's returned info, we'll also have the options of the poll, it'll be a field named options. Each option's info will be given within this field, and each option has a votes field, which will tell you the number of votes that option received. So you'll have the results of the poll.
Use the graph explorer, to test these things, before you code them. And do read the documentation links to know more about questions.
In general the metadata=1 GET parameter tells you if there is more related data available.
When requesting users to register with Facebook connect I can access their hometown (which is a location id as well as the name). Is anyone aware if it is possible to get the geo-coded location for this (e.g. retrieve the latitude/longitude as well as the name?) I cannot see it as part of the documentation.
I could geocode it using the hometown with the google geo coding service, but was wondering if another option?
It's not possible. The information you can retrieve about a user is here. As you can see the only location based info is hometown (like you said). If you want latitude/longitude you will have to calculate it yourself from the hometown.
You can grab the id out of the location record that is returned on the user:
"location": {
"id": "106224666074625",
"name": "Austin, Texas"
},
and make a graph call:
GET https://graph.facebook.com/106224666074625?fields=location
which returns:
{
"location": {
"street": "",
"zip": "",
"latitude": 30.2672,
"longitude": -97.7639
},
"id": "106224666074625"
}