I have this JSON data from my facebook page:
{
"data": [
{
"id": "1234567890_0987654321",
"from": {
"name": "My Facebook Page",
"category": "Personal blog",
"id": "1234567890"
},
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/1234567890/posts/0987654321"
},
{
"name": "Like",
"link": "http://www.facebook.com/1234567890/posts/0987654321"
},
{
"name": "Action Name",
"link": "http://example.com/"
}
],
"message": "This post discusses something about Javascript.",
"name": "A post about javascript.",
"link": "http://example.com/",
"caption": "JavaScript",
"description": "Something telling about the post.",
"created_time": "2012-10-09T03:35:22+0000"
},
{
"id": "1234567890_0987654321",
"from": {
"name": "My Facebook Page",
"category": "Personal blog",
"id": "1234567890"
},
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/1234567890/posts/0987654321"
},
{
"name": "Like",
"link": "http://www.facebook.com/1234567890/posts/0987654321"
},
{
"name": "Action Name",
"link": "http://example.com/"
}
],
"message": "This post discusses something about CSS.",
"name": "A post about CSS.",
"link": "http://example.com/",
"caption": "CSS",
"description": "Something telling about the post.",
"created_time": "2012-10-09T03:35:22+0000"
}
]
}
Is there anyway I can do this with FQL where I will just have all the posts with "caption": "JavaScript"? I want to sort my post by category and my keywords are inside the "caption" attribute.
IF you want to get feeds short by order you need to use FQL
here is sample one of them
SELECT post_id, actor_id, target_id,description, message FROM stream WHERE source_id = me() order by description
Thank you to all who responded my question. I think I got the answer to my question already.
I will just do this query on FQL to get all posts with "caption": "Javascript":
SELECT actor_id,message,attachment FROM stream WHERE source_id=1234567890 AND attachment.caption="Javascript"
Related
enter image description hereThis is the first time i've tried to add code into my website so I'm very new to the whole thing... What I'm trying to do is add the 'how did you hear about us' question to the checkout process on my website.
Specifically, I'm having trouble trying to add a theme setting to my website using coding instructions from 'shopify developers'. In the configuration directory of 'Themes', after clicking on settings_schema.json , I follow instructions to add some code after the first curly bracket }, but when I do so and try hit save, the error message 'Invalid JSON: unexpected token' comes up. If anyone can help me that would be hugely appreciated! I'm pasting below the existing code, and below that the snippet of code I'm trying to insert. Just FYI I am using safari.
Does anyone have any idea?
Best,
Cosmo
exisiting code
[
{
"name": "theme_info",
"theme_name": "Themekit template theme",
"theme_version": "1.0.0",
"theme_author": "Shopify",
"theme_documentation_url": "https:\/\/github.com\/Shopify\/themekit",
"theme_support_url": "https:\/\/github.com\/Shopify\/themekit\/issues"
}
]
new code I'm trying to insert
{
"name": "Hear About Us",
"settings": [
{
"type": "text",
"id": "hau_form_options",
"label": "Form options",
"default": "Facebook, Twitter, Google, Instagram, Youtube",
"info": "Separate each option with a comma"
},
{
"type": "header",
"content": "Form validation"
},
{
"type": "checkbox",
"id": "hau_form_validation",
"label": "Enable form validation",
"default": true
},
{
"type": "text",
"id": "hau_error_message",
"label": "Error message",
"info": "The error message that is displayed when no selection is made",
"default": "Please select an option below"
},
{
"type": "text",
"id": "hau_error_message_other",
"label": "Other field error message",
"info": "The error message that is displayed when there is no input in the 'Other' field",
"default": "Please fill the text field below"
},
{
"type": "header",
"content": "Error styling"
},
{
"type": "color",
"id": "hau_error_color",
"label": "Color",
"default": "#ff0000"
}
]
},
I checked the JSON using JSONLint, and it looks like the trailing comma on the end is messing it up.
EDIT: I see the image now, the comma needs to be added before since you are adding it to an Array.
[{
"name": "theme_info",
"theme_name": "Themekit template theme",
"theme_version": "1.0.0",
"theme_author": "Shopify",
"theme_documentation_url": "https:\/\/github.com\/Shopify\/themekit",
"theme_support_url": "https:\/\/github.com\/Shopify\/themekit\/issues"
},
{
"name": "Hear About Us",
"settings": [{
"type": "text",
"id": "hau_form_options",
"label": "Form options",
"default": "Facebook, Twitter, Google, Instagram, Youtube",
"info": "Separate each option with a comma"
},
{
"type": "header",
"content": "Form validation"
},
{
"type": "checkbox",
"id": "hau_form_validation",
"label": "Enable form validation",
"default": true
},
{
"type": "text",
"id": "hau_error_message",
"label": "Error message",
"info": "The error message that is displayed when no selection is made",
"default": "Please select an option below"
},
{
"type": "text",
"id": "hau_error_message_other",
"label": "Other field error message",
"info": "The error message that is displayed when there is no input in the 'Other' field",
"default": "Please fill the text field below"
},
{
"type": "header",
"content": "Error styling"
},
{
"type": "color",
"id": "hau_error_color",
"label": "Color",
"default": "#ff0000"
}
]
}
]
For the json data below unable to show the button in Microsoft Team
but that is work fine in Outlook. Anyone can help me solve this ? ty
Pls refer to the photo link below .
{"#type": "MessageCard",
"title": "System Alert",
"text" : "Network Error",
"themeColor": "E81123",
"potentialAction": [
{
"#type": "ActionCard",
"name": "",
"inputs": [
{
"#type": "TextInput",
"id": "comment",
"title": "Enter your comment",
"isMultiline": "true"
}
],
"actions": [
{
"#type": "HttpPOST",
"name": "OK",
"target": "https://ptsv2.com/t/ANA/post",
"body": "comment={{comment.value}}"
}
]
}
]
}
Microsoft Teams output
Outlook output
Please try putting in name value for action card ( "name": "ActionCardName" )
{"#type": "MessageCard",
"title": "System Alert",
"text" : "Network Error",
"themeColor": "E81123",
"potentialAction": [
{
"#type": "ActionCard",
"name": "ActionCardName",
"inputs": [
{
"#type": "TextInput",
"id": "comment",
"title": "Enter your comment",
"isMultiline": "true"
}
],
"actions": [
{
"#type": "HttpPOST",
"name": "OK",
"target": "https://ptsv2.com/t/ANA/post",
"body": "comment={{comment.value}}"
}
]
}
]
}
You could MessageCard Playground to test this by using Send Via Webhook button.
OK, this is probably a REAL simple request.
But, I have 4 JSON files, well, I get JSON when doing a GET to a
//some IP address/some directory/some sub directory/name of folder
So I get back let's just say, NETWORKS, SITES, RESOURCES, COMPONENTS
Each one below NETWORKS is the CHILD...
Ok, next: I need to COMBINE these JSON files to populate JSTree (from jstree.com)
I have a basic JSON file like this and it WORKS beautifully:
(NOTE: the ID's below are irrelevant and DO NOT match in the REAL examples farther down here.)
The intent here is to JOIN all four JSON objects which I'm getting through a RESTful environment to JAVA API's that GET the data from the database.
[
{
"data": "Network 1",
"metadata": {"id" : "n1"},
"children": [ {
"data": "Site 1",
"metadata": {"id" : "s1"},
"children": [ {
"data": "Resource 1",
"metadata": {"id" : "r1"},
"children": [
{
"data": "Component 1",
"metadata": {"id" : "c1"}
},
{
"data": "Component 2",
"metadata": {"id" : "c2"}
},
{
"data": "Component 3",
"metadata": {"id" : "c3"}
} ] } ] },
"Site 2",
"Site 3",
"Site 4"]
}
]
Here's my dilemma:
I need to combine the following JSON files: SITES, RESOURCES, and COMPONENTS
Simple right? Not so much.
Here's a sample of each of the lower level JSON Objects:
NETWORKS:
[
{
"id": "23ef0d23-0d8d-4466-98da-81ef30791773",
"notes": "This is a network for network 1",
"name": "n1"
},
{
"id": "b4b46748-511a-49bf-9d22-8da014c76cc2",
"notes": "This is a network for network 2",
"name": "n2"
},
{
"id": "678b4a01-a6a6-449f-966d-c50c74964729",
"notes": "This is a network for network 3",
"name": "n3"
},
{
"id": "8e2822b1-49a8-498e-979b-2849cfa82148",
"notes": "This is a network for network 4",
"name": "n4"
}
]
SITES:
[
{
"id": "05683e7b-e471-4417-bead-317cfcbfaf30",
"name": "s1",
"networkId": "23ef0d23-0d8d-4466-98da-81ef30791773",
"notes": "This is site 1"
},
{
"id": "de8d654c-f9c4-4a4e-8742-32794b218b54",
"name": "s2",
"networkId": "23ef0d23-0d8d-4466-98da-81ef30791773",
"notes": "This is site 2"
},
{
"id": "16b2b1cf-2991-4717-ae65-2158700fa95d",
"name": "s3",
"networkId": "8e2822b1-49a8-498e-979b-2849cfa82148",
"notes": "This is site 3"
}
]
RESOURCES:
[
{
"id": "26db6a18-5099-4117-9adb-b8c808a3c478",
"networkId": "23ef0d23-0d8d-4466-98da-81ef30791773",
"siteId": "05683e7b-e471-4417-bead-317cfcbfaf30",
"name": "r1",
"notes": "This is Resource 1"
},
{
"id": "26ad2b53-f4b2-41c1-a618-d9e710452b7f",
"networkId": "23ef0d23-0d8d-4466-98da-81ef30791773",
"siteId": "05683e7b-e471-4417-bead-317cfcbfaf30",
"name": "r2",
"notes": "This is Resource 2"
}
]
And Finally, COMPONENTS:
[
{
"id": "6e8d13ad-9eb6-4213-bf84-a6e91d2e1460",
"resourceId": "26ad2b53-f4b2-41c1-a618-d9e710452b7f",
"siteId": "05683e7b-e471-4417-bead-317cfcbfaf30",
"networkId": "23ef0d23-0d8d-4466-98da-81ef30791773",
"name": "Component 1",
"notes": "This is my very first component - Yay!"
},
{
"id": "8f18cca3-378e-4f9b-8a39-eb2285fa61fd",
"resourceId": "26ad2b53-f4b2-41c1-a618-d9e710452b7f",
"siteId": "05683e7b-e471-4417-bead-317cfcbfaf30",
"networkId": "23ef0d23-0d8d-4466-98da-81ef30791773",
"name": "Component 2",
"notes": "This is my Second component - Yay!"
},
{
"id": "539370a6-577f-477d-a6ea-d45efd7e65aa",
"resourceId": "26ad2b53-f4b2-41c1-a618-d9e710452b7f",
"siteId": "05683e7b-e471-4417-bead-317cfcbfaf30",
"networkId": "23ef0d23-0d8d-4466-98da-81ef30791773",
"name": "Component 3",
"notes": "This is my Third component - Yay!"
}
]
Ultimately, when combined, it's GOT to look like the very first JSON example which WORKS for JSTree.
Thank you all for helping.
Regards
I wont to get the best comment of a page
more like
more old
from:
https://graph.facebook.com/comments/?ids=[YOUR PAGE]
i get this result:
{"[YOUR PAGE]": {
"comments": {
"data": [
{
"id": "10150129443959608_15887865",
"from": {
"name": "Trent Seed",
"id": "614130500"
},
"message": "that house is huge!!",
"created_time": "2011-04-13T10:00:44+0000"
},
{
"id": "10150129443959608_15902791",
"from": {
"name": "Mitch Seed",
"id": "688036079"
},
"message": "wtf this is ridiculous! I cant believe this is actually right by us.",
"created_time": "2011-04-14T02:17:18+0000",
"comments": {
"data": [
{
"id": "10150155952624608",
"from": {
"name": "Ethan Ming",
"id": "592969356"
},
"message": "where does all that flat land come from in los altos HILLS? oh i guess that $100 million also went to removing a small mountain too",
"created_time": "2011-04-14T02:43:57+0000"
},
{
"id": "10150155954519608",
"from": {
"name": "Mitch Seed",
"id": "688036079"
},
"message": "yeah haha thats just straight ridiculous i have ran all through los altos hills i dont remember any land like this haha",
"created_time": "2011-04-14T02:46:40+0000"
},
{
"id": "10150155969784608",
"from": {
"name": "Leila Marie",
"id": "1044030343"
},
"message": "jus copied you haha this is crazy",
"created_time": "2011-04-14T03:13:07+0000"
}
],
"count": 3
}
},
{
"id": "10150129443959608_15932966",
"from": {
"name": "Arthur Lozinski",
"id": "1044030063"
},
"message": "digital sky technologies. remember that name :-D",
"created_time": "2011-04-15T15:42:23+0000"
},
{
"id": "10150129443959608_15962947",
"from": {
"name": "Brian Sator",
"id": "513517991"
},
"message": "I feel like I would get lost in that place.",
"created_time": "2011-04-17T08:03:24+0000",
"likes": 1
},
{
"id": "10150129443959608_16282803",
"from": {
"name": "Jordan McDaniel",
"id": "506352386"
},
"message": "holy shit",
"created_time": "2011-05-04T04:29:27+0000",
"comments": {
"data": [
{
"id": "10150172606879608",
"from": {
"name": "Davey Nicholas",
"id": "1346961549"
},
"message": "\"no plans to move into the mansion\" whos' tryina squat",
"created_time": "2011-05-04T04:35:16+0000"
}
],
"count": 1
}
}
],
"paging": {
"next": "[link]"
}
}
}
}
i wont to get the best message of the json file (or is possible in other way?)
try fql
SELECT id,text,likes FROM comment WHERE object_id=[page_id] order by likes desc
with graphs
https://graph.facebook.com/fql=SELECT+id,text,likes+FROM+comment+WHERE+object_id=[page_id]+order+by+likes+desc
see more about fql
I guess this is a big ask. Using PHP I grab this Facebook Graph API json feed json feed link
{
"data": [
{
"id": "10369058551_10150645263758552",
"from": {
"name": "Land Rover",
"category": "Cars",
"id": "10369058551"
},
"message": "This week's Land Rover photo of the week is by Rodrigo Beja. Don't forget to submit your best photos each week to get featured.",
"link": "http://www.facebook.com/photo.php?fbid=10150645263678552&set=a.443106273551.221975.10369058551&type=1",
"icon": "http://static.ak.fbcdn.net/rsrc.php/v1/yz/r/StEh3RhPvjk.gif",
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/10369058551/posts/10150645263758552"
},
{
"name": "Like",
"link": "http://www.facebook.com/10369058551/posts/10150645263758552"
}
],
"privacy": {
"description": "United Kingdom",
"value": "CUSTOM"
},
"type": "photo",
"object_id": "10150645263678552",
"created_time": "2012-02-03T17:19:03+0000",
"updated_time": "2012-02-03T22:32:28+0000",
"likes": {
"data": [
{
"name": "Mandy Elder",
"id": "100000250758731"
}
],
"count": 85
},
"comments": {
"data": [
{
"id": "10369058551_10150645263758552_6835532",
"from": {
"name": "John Sharp",
"id": "652940638"
},
"message": "This photo was used as part of the g4 challenge publicity photo pack around 2005-6 \nI remember because at the time I used it as a profile pic on msn \n\nAwesome photo - sums it up perfectly - I love it!!",
"created_time": "2012-02-03T21:39:48+0000"
},
{
"id": "10369058551_10150645263758552_6835852",
"from": {
"name": "Kathryn Piddington",
"id": "777370532"
},
"message": "Mud is good for the soul :)",
"created_time": "2012-02-03T22:32:28+0000"
}
],
"count": 14
}
},
{
"id": "10369058551_355476307803889",
"from": {
"name": "Land Rover",
"category": "Cars",
"id": "10369058551"
},
"message": "Click below to watch the new Range Rover Sport advert and catch up on the latest Land Rover and Range Rover news in this week\u2019s round-up. ",
"picture": "http://external.ak.fbcdn.net/safe_image.php?d=AQAx7xz602rfhyIn&w=90&h=90&url=http\u00253A\u00252F\u00252Fblog.landrover.com\u00252Fwp-content\u00252Fuploads\u00252F12my_rrs_044_LowRes.jpg",
"link": "http://blog.landrover.com/vehicles/the-land-rover-and-range-rover-weekly-19-3578.html#axzz1lKthI4F1",
"name": "The Land Rover and Range Rover Weekly 19 | Land Rover Blog",
"caption": "blog.landrover.com",
"description": "In this week\u2019s round-up of all things Land Rover and Range Rover, the new Range Rover Sport advert, Which? figures reveal the running costs of the Range Rover Evoque in comparison with competitors and a history of Land Rover narrated by Ranulph Fiennes.",
"icon": "http://static.ak.fbcdn.net/rsrc.php/v1/yD/r/aS8ecmYRys0.gif",
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/10369058551/posts/355476307803889"
},
{
"name": "Like",
"link": "http://www.facebook.com/10369058551/posts/355476307803889"
}
],
"privacy": {
"description": "United Kingdom",
"value": "CUSTOM"
},
"type": "link",
"created_time": "2012-02-03T16:44:42+0000",
"updated_time": "2012-02-03T16:44:42+0000",
"likes": {
"data": [
{
"name": "Steve Nesbitt",
"id": "533982936"
}
],
"count": 10
},
"comments": {
"count": 0
}
},
{
"id": "10369058551_10150642499593552",
I'd like to the top level items to a mysql table, then each sub level to anaother table keeping a key / link between each table and then any sub level of a sublevel and linking this too. Is this possible?
I have got as far as this:-
$page = file_get_contents($url);
$json_output = json_decode($page, true);
I can't figure out how to loot hrough each row and add teh data to a Mysql table.
Thanks for your help in advance
Jonathan
Try to loop it as array then make sql query. Each array you put a unique key (for top level item). So, you can use your top level key to sub level foreign key..