I am trying to develop a web application that can fetch data from Asana and generate custom spreadsheet reports. This wrapper class was very helpful in making things simple.
However, I am having a hard time in writing code that gets me the team/s that a particular task belongs to. Even when I export data as JSON through Asana's web application the 'teams' find no mention. From what I understand, Asana itself does not provide an association between teams and tasks. Please correct me if I am wrong.
But if I am right at my conclusion, is there a workaround I could use? Teams are an important part of my data rendering and I need them to be mapped correctly in my reports that I am trying to generate from Asana. The report I want to generate would be hierarchical in nature.
Organisation
Team
Projects
Tasks
Subtask
Can I do something to achieve this hierarchy? The only place I get stuck is getting the projects under a particular team.
Glad to hear that you found that wrapper useful. We will be releasing a PHP Library ourselves soon that you may be interested in. Stay tuned!
Below is some pseudo-code to derive the hierarchy you are looking for, I think. Let me know if it helps.
GET /workspaces
{
"data": [
{
"id": 1234,
"name": "Startup Inc"
}
]
}
GET /workspaces/1234
{
"data": {
"id": 1234,
"name": "Startup Inc",
"is_organization": true,
...
}
}
Because is_corganization is true, we can then continue...
GET /organizations/organization-id/teams
{
"data": [
{
"id": 9876,
"name": "Ninja Team"
}
]
}
GET /teams/9876/projects
{
"data": [
{
"id": 5678,
"name": "Stealth Project"
}
]
}
GET /projects/5678/tasks
{
"data": [
{
"id": 8675309,
"name": "Top secret video"
}
]
}
GET /tasks/8675309
{
"data": {
"id": 8675309,
"created_at": "2015-03-25T17:28:59.255Z",
"modified_at": "2015-05-15T03:13:28.754Z",
"name": "Top secret video",
"notes": "https://www.youtube.com/watch?v=6WTdTwcmxyo",
"completed": false,
... # All the task data
]
}
}
Related
I am building a Laravel 5 app to get the facebook page insights for my client. I am using the Facebook PHP business SDK to make calls to the facebook graph API. The problem appears when I try to get the full list of pages a user has a role on. The app was reviewed by Facebook and has manage_pages permission granted (I know there is a pages_show_list permission but in the docs is specified that any of them will work).
The procedure is simple and very similar to this code:
https://github.com/facebook/facebook-php-business-sdk/blob/master/examples/UserAccountsEdge.php
where $access_token is the user access token, not the page access token because the page access token will be sent by the graph API in the response.
I am getting this error from the Graph API:
{
"error": {
"message": "Application request limit reached",
"type": "OAuthException",
"is_transient": false,
"code": 4,
"error_subcode": 1349193,
"error_user_title": "Exceeded asset access limit",
"error_user_msg": "You have exceeded asset access limit for the calling user. For asset type page, there is a limit to 3 instances the app can access for the caller.",
"fbtrace_id": "AnTVYLGrhtjHlL7DgK0zB-A"
}
}
Indeed the number of the items in the accounts (pages) list is limited to 3 and I do not know why. If a user has roles on 20 pages I just can’t get the complete list of those pages.
The errors disappear if I am using the $limit => 3 (or less) field inside the $fields array. In this situation the response of the API looks like this (I deleted the real content to simplify the reading):
{
"data": [
{
"access_token": "...token...",
"category": "...category name...",
"category_list": [
{
"id": "...id...",
"name": "...name..."
}
],
"name": "...page name...",
"id": "...page id...",
"tasks": [
"ANALYZE",
"ADVERTISE",
"MODERATE",
"CREATE_CONTENT",
"MANAGE"
]
},
{
"access_token": "...token...",
"category": "...category name...",
"category_list": [
{
"id": "...id...",
"name": "...name..."
}
],
"name": "...page name...",
"id": "...page id...",
"tasks": [
"ANALYZE",
"ADVERTISE",
"MODERATE",
"CREATE_CONTENT",
"MANAGE"
]
},
{
"access_token": "...token...",
"category": "...category name...",
"category_list": [
{
"id": "...id...",
"name": "...name..."
}
],
"name": "...page name...",
"id": "...page id...",
"tasks": [
"ANALYZE",
"ADVERTISE",
"MODERATE",
"CREATE_CONTENT",
"MANAGE"
]
}
],
"paging": {
"cursors": {
"before": "...",
"after": "..."
},
"next": "https://graph.facebook.com/v3.3/...id.../accounts?access_token=...token..."
}
}
I tried to use cursors, implicit fetching and iterations ( foreach, $cursor->rewind(), $cursor->next() ) to get previous / next items from the list but still no success. The limitation of 3 items in the accounts (pages) list cannot be exceeded. Has anybody encountered this problem and found a solution to it? I have spent many hours to search in the facebook developers docs for a solution or an explanation of this kind of rate limiting but found nothing related to this.
I have also used the Graph API Explorer to test the calls and the result is exactly the same.
Is there any way to limit the results returned by the Google Books API?
For example the following URL:
https://www.googleapis.com/books/v1/volumes?q=isbn:0751538310
Returns the following:
"kind": "books#volumes",
"totalItems": 1,
"items": [
{
"kind": "books#volume",
"id": "ofTsHAAACAAJ",
"etag": "K6a+5IuCMD0",
"selfLink": "https://www.googleapis.com/books/v1/volumes/ofTsHAAACAAJ",
"volumeInfo": {
"title": "Panic",
"authors": [
"Jeff Abbott"
],
"publisher": "Grand Central Publishing",
"publishedDate": "2006",
"description": "Things are going well for young film-maker Evan Casher - until he receives an urgent phonecall from his mother, summoning him home. He arrives to find her brutally murdered body on the kitchen floor and a hitman lying in wait for him. It is then he realises his whole life has been a lie. His parents are not who he thought they were, his girlfriend is not who he thought she was, his entire existence an ingeniously constructed sham. And now that he knows it, he is in terrible danger. So he is catapulted into a violent world of mercenaries, spies and terrorists. Pursued by a ruthless band of killers who will stop at nothing to keep old secrets buried, Evan's only hope for survival is to discover the truth behind his past. An absolute page-turner, Panic has been acclaimed as one of the most exciting thrillers of recent years.",
"industryIdentifiers": [
{
"type": "ISBN_10",
"identifier": "0751538310"
},
{
"type": "ISBN_13",
"identifier": "9780751538311"
}
],
"readingModes": {
"text": false,
"image": false
},
"pageCount": 408,
"printType": "BOOK",
"categories": [
"Austin (Tex.)"
],
"maturityRating": "NOT_MATURE",
"allowAnonLogging": false,
"contentVersion": "preview-1.0.0",
"imageLinks": {
"smallThumbnail": "http://books.google.com/books/content?id=ofTsHAAACAAJ&printsec=frontcover&img=1&zoom=5&source=gbs_api",
"thumbnail": "http://books.google.com/books/content?id=ofTsHAAACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api"
},
"language": "en",
"previewLink": "http://books.google.co.uk/books?id=ofTsHAAACAAJ&dq=isbn:0751538310&hl=&cd=1&source=gbs_api",
"infoLink": "http://books.google.co.uk/books?id=ofTsHAAACAAJ&dq=isbn:0751538310&hl=&source=gbs_api",
"canonicalVolumeLink": "https://books.google.com/books/about/Panic.html?hl=&id=ofTsHAAACAAJ"
},
"saleInfo": {
"country": "GB",
"saleability": "NOT_FOR_SALE",
"isEbook": false
},
"accessInfo": {
"country": "GB",
"viewability": "NO_PAGES",
"embeddable": false,
"publicDomain": false,
"textToSpeechPermission": "ALLOWED",
"epub": {
"isAvailable": false
},
"pdf": {
"isAvailable": false
},
"webReaderLink": "http://books.google.co.uk/books/reader?id=ofTsHAAACAAJ&hl=&printsec=frontcover&output=reader&source=gbs_api",
"accessViewStatus": "NONE",
"quoteSharingAllowed": false
},
"searchInfo": {
"textSnippet": "An absolute page-turner, Panic has been acclaimed as one of the most exciting thrillers of recent years."
}
}
]
Is there any way I can return only the title and description? I think it may improve performance of my web application.
I have looked at the partial response but it doesn't seem to work.
I am including my API key in the URL query parameter.
Thanks
I added the params according to the partial response documentation.
See the params in following link:
https://www.googleapis.com/books/v1/volumes?q=isbn:0751538310&fields=items(volumeInfo/description,volumeInfo/title)
It will return:
{
"items": [
{
"volumeInfo": {
"title": "Panic",
"description": "Things are going well for young film-maker Evan Casher - until he receives an urgent phonecall from his mother, summoning him home. He arrives to find her brutally murdered body on the kitchen floor and a hitman lying in wait for him. It is then he realises his whole life has been a lie. His parents are not who he thought they were, his girlfriend is not who he thought she was, his entire existence an ingeniously constructed sham. And now that he knows it, he is in terrible danger. So he is catapulted into a violent world of mercenaries, spies and terrorists. Pursued by a ruthless band of killers who will stop at nothing to keep old secrets buried, Evan's only hope for survival is to discover the truth behind his past. An absolute page-turner, Panic has been acclaimed as one of the most exciting thrillers of recent years."
}
}
]
}
maxResults
include this in your query. 5 is just an integer.
&maxResults=5
Google will help you create your API with this website API called try it.
https://developers.google.com/books/docs/v1/reference/volumes/list?apix=true#try-it
Maybe its too late to respond but you need to activate the API before accessing it. When you try to access it says to activate it from console with some project id. Just copy that url and it takes you straight to your dashboard where you can find your activation button post which you can access the partial response with desired attributes.
I'm currently storing user-generated surveys in JSON files, and am now converting these to a sql database. Regarding this portion of JSON:
"surveys": [
{
"surveyId": 1,
"name": "Landing Page Survey",
"active": true,
"panes": [
{
"type": "question",
"name": "Question",
"head": "Is there anything preventing you from signing up for a free 14-day trial?",
"response": "textbox",
"options": [
{
"data": "Time",
"target": "Response 1",
"placeholder": "",
"list": "f7b3cdeed8"
},
{
"data": "Money",
"target": "Response 1",
"placeholder": "",
"list": "local"
},
{
"data": "I'm not interested",
"target": "Thanks",
"placeholder": "",
"list": "local"
}
],
"button": "Send"
},
{
"type": "response",
"name": "Response 1",
"head": "Thanks for your interest in our product. Enter your email address to have a team member follow-up with you.",
"response": "email",
"options": [
{
"data": "data",
"target": "Thanks",
"placeholder": "Your email",
"list": "f7b3cdeed8"
}
],
"button": "Submit"
},
{
"type": "thanks",
"name": "Thanks",
"head": "Thanks for your feedback!",
"response": "multichoice",
"options": [
{
"data": "data",
"target": "",
"placeholder": "put response here",
"list": "local"
}
],
"button": "Button text"
}
]
The JSON isn't that important, just posting so you can see the idea.. surveys.panes are the questions of the survey. Each survey could have an infinite number of questions in it, so I'm struggling with how to store those.
Originally I was thinking of having a surveys table with columns for the questions, 'question_1_type, question_1_text', etc.. This would work if each survey was limited to an amount of questions (10 for example, so I could create 10 sets of columns). This feels horribly wrong though.
Or is it more correct to create a questions table, and for each question in a survey create a row in the questions table. Link it to the survey table with an id, then when you want to output the survey JSON for an API or whatever, just do a bunch of joins across the survey and questions table.
Also, if a survey question is multiple choice, it could have an infinite number of response options also, so would you have to build a table for those as well? Then for each survey JSON build you'd have to join across the surveys, questions, and question_options table. That seems like a lot of overhead running all the joins..
But as I understand, it's incorrect to store anything but one value in a column (an array for example) as it defeats the relational idea of a sql db.
Very noob question.. I haven't quite wrapped my head around correct database design. Appreciate any help!
So I'm performing a query and getting data back like this:
[
{ "part_number": "MAC0009", "description": "Accessory Stand Foot" },
{ "part_number": "MAC0010", "description": "Accessory Stand Collar Tapped M5" },
{ "part_number": "MAC0011", "description": "Accessory Stand Top Collar" },
{ "part_number": "MAC0012", "description": "25mm Round Knob With 2 Rail Holes" }
]
However for the AJAX script I'm trying to implement I need the data in this format:
[
{ "MAC0009" : "Accessory Stand Foot" },
{ "MAC00010" : "Accessory Stand Collar Tapped M5" },
{ "MAC00012" : "Accessory Stand Top Collar" }
]
So basically I need plain data back without the table names.
All I have so far is the query.
$result = DB::table('macs')->select('part_number', 'description')->get();
Which is obviously fine but I don't know how to manipulate the data into that format :/ Any help appreciated.
You can use lists method:
DB::table('macs')->select('part_number', 'description')->lists('description', 'part_number');
How can we identity the date on which someone liked my page.
is there any way where we can identify the date on which someone liked my page ?
No. You can't even get a list of people that like your page, so you can't get a date they liked it. The only information you can get is how many people like it.
You can view a chart of how many people liked your page over time at Facebook Insights.
Well no, You can make a graph call to the statuses and feeds of a user with valid access_token to get the id and name of the people who liked the post.. The timestamp can be found for the comments though ..
{
"id": "257821xxxxxxx",
"from": {
"name": "Maxxxxxx",
"id": "100xxxxxx"
},
"message": "incredible ..",
"updated_time": "2011-09-15T11:21:15+0000",
"likes": {
"data": [
{
"id": "6xxxxxx6",
"name": "Axxxxxxxxxa"
}
]
},
"comments": {
"data": [
{
"id": "257xxxxxxxxxxxx904",
"from": {
"name": "Maxxxxxxxxxxal",
"id": "1xxxxxxxxxxxxxx"
},
"message": "htxxxxxxxxxxxxxxxxxxxxxxxxxx",
"can_remove": true,
"created_time": "2011-09-15T11:22:06+0000"
}
]
}
}