"accounts": {
"data": [
{
"posts": {
"data": [
{
"id": "76917571976",
"created_time": "2015-03"
},
{
"id": "76917571976118",
"created_time": "2014-09-07"
},
{
"id": "76917571976",
"created_time": "2014-04-15"
},
{
"id": "7691757197611",
"created_time": "2014-04-11"
},
{
"id": "76917571976118",
"created_time": "2014-03-11"
}
],
"paging": {
"previous": "https//facebook.com",
"next": "http://ift.tt/wljqS4"
}
},
"id": "12343"
}
]
I have been trying the get the value of the "id":
attribute inside "data":
. I am using the graph api to get the id of a post The code I am using is ['accounts']['data'][0]['posts'][0]['id]
but it's giving an error
undefined method `[]' for nil:NilClass
which obviously is due the fact that it's not able to retrieve any value from the graph api.
Can somebody help me with this, thank you in advance.
Aucun commentaire:
Enregistrer un commentaire