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.
Related
We want to get the insights per campaign for multiple campaigns that belong to a specific ad account in a single call.
I am using the following http call and it returns me the correct insights(reach, impressions and clicks) and other data per campaign for the last 30 days only.
https://graph.facebook.com/v3.3/<ad_account>/campaigns?fields=name,status,insights{reach,impressions,clicks}&access_token=<access_token>
How can I use the parameter date_preset so that I will be able to get the insights(reach, impressions and clicks) and other data per campaign for lifetime?
If there is any other way to get the above insights for lifetime without using the date_preset please do not hesitate to advise me how to get them.
We wanted to let you know that our app is written in php.
Because insights is an edge of the campaign object you can apply some filter parameters via dot on that edge, like this:
https://graph.facebook.com/v3.3/<ad_account>/campaigns?fields=name,status,insights.date_preset(lifetime){reach,impressions,clicks}&access_token=<access_token>
Or, if you want to check Insights with the time breakdown (three months, for example) and also take a look on the lifetime summary you can do it like this:
https://graph.facebook.com/v3.3/<ad_account>/campaigns?fields=name,status,insights.default_summary(true).limit(3).date_preset(lifetime).time_increment(monthly){reach,impressions,clicks}&access_token=<access_token>
{
"name": "Campaign Name",
"status": "Campaign Status",
"insights": {
"data": [
{
"reach": "149599",
"impressions": "291917",
"clicks": "13517",
"date_start": "2019-01-11",
"date_stop": "2019-01-31"
},
{
"reach": "265556",
"impressions": "456458",
"clicks": "7915",
"date_start": "2019-02-01",
"date_stop": "2019-02-28"
},
{
"reach": "233641",
"impressions": "331600",
"clicks": "4671",
"date_start": "2019-03-01",
"date_stop": "2019-03-31"
}
],
"paging": {
"cursors": {
"before": "BFR",
"after": "AFT"
},
"next": "next link"
},
"summary": {
"reach": "660772",
"impressions": "1486924",
"clicks": "32484",
"date_start": "2019-01-11",
"date_stop": "2019-05-06"
}
},
"id": "000"
}
https://developers.facebook.com/docs/marketing-api/insights/parameters#param
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!
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
]
}
}
I get the following response from the google:
{
"kind": "books#volumes",
"totalItems": 1,
"items": [
{
"kind": "books#volume",
"id": "t9S82uKGp8IC",
"etag": "rn9INXAtx88",
"selfLink": "https://www.googleapis.com/books/v1/volumes/t9S82uKGp8IC",
"volumeInfo": {
"title": "Classic Swedish Interiors",
"authors": [
"Lars Sjöberg",
"Ingalill Snitt"
],
"publisher": "Frances Lincoln Ltd",
"publishedDate": "2010-09-07",
"description": "Lars Sjöberg has made it his life's work to understand and preserve the Swedish manor houses of the 17th and 18th centuries. Here, exquisitely photographed by Ingalill Snitt, are the eight houses (and one church) that he has acquired over more than 40 years. The book focuses on Sjöberg's first, most complex project: the manor of Regnaholm. Unoccupied for about 40 years when Sjöberg arrived in 1966, it allowed him to experiment with interior decoration and refurnishing, copying old furniture, reweaving, and reprinting old fabric patterns. His other projects include Ekensberg, a three-story Italianate villa near Lake Mälaren, built in 1788-90, and Salaholm in Västergötland with a garden laid out in the first half of the 17th century. Odenslunda, a small manor from the 1770s with a panelled exterior and a säteritak or manor-house roof, is his family home, while Sörby, a scaled-down early 17th-century manor house, was reproduced in its entirety for an exhibition in Stockholm. Full of insight and inspiration, this is a deeply personal summary of everything Lars Sjöberg has learned in his years of working and living with classic Swedish interiors.",
"industryIdentifiers": [
{
"type": "ISBN_10",
"identifier": "0711230889"
},
{
"type": "ISBN_13",
"identifier": "9780711230880"
}
],
"pageCount": 208,
"printType": "BOOK",
"categories": [
"Architecture"
],
"contentVersion": "preview-1.0.0",
"imageLinks": {
"smallThumbnail": "http://bks8.books.google.com/books?id=t9S82uKGp8IC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api",
"thumbnail": "http://bks8.books.google.com/books?id=t9S82uKGp8IC&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api"
},
"language": "en",
"previewLink": "http://books.google.com/books?id=t9S82uKGp8IC&printsec=frontcover&dq=isbn:9780711230880&cd=1&source=gbs_api",
"infoLink": "http://books.google.com/books?id=t9S82uKGp8IC&dq=isbn:9780711230880&source=gbs_api",
"canonicalVolumeLink": "http://books.google.com/books/about/Classic_Swedish_Interiors.html?id=t9S82uKGp8IC"
},
"saleInfo": {
"country": "ZA",
"saleability": "NOT_FOR_SALE",
"isEbook": false
},
"accessInfo": {
"country": "ZA",
"viewability": "PARTIAL",
"embeddable": true,
"publicDomain": false,
"textToSpeechPermission": "ALLOWED_FOR_ACCESSIBILITY",
"epub": {
"isAvailable": false
},
"pdf": {
"isAvailable": true,
"acsTokenLink": "http://books.google.com/books/download /Classic_Swedish_Interiors-sample-pdf.acsm?id=t9S82uKGp8IC&format=pdf&output=acs4_fulfillment_token&dl_type=sample&source=gbs_api"
},
"webReaderLink": "http://books.google.com/books/reader?id=t9S82uKGp8IC& printsec=frontcover&output=reader&source=gbs_api",
"accessViewStatus": "SAMPLE"
},
"searchInfo": {
"textSnippet": "Full of insight and inspiration, this is a deeply personal summary of everything Lars Sjöberg has learned in his years of working and living with classic Swedish interiors."
}
}
]
What is this format called? (It's not XML or JSON?)
How do I convert this text into an PHP array?
It's JSON. You can use json_decode() to convert it into a PHP associative array.
$books = json_decode($your_json_data, true);
print_r($books);
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"
}
]
}
}