문제

Presently what I do is call the following APIs

$url    = 'https://www.googleapis.com/freebase/v1/search?query='. $query; // to fetch name and id

and using the id from the result of above API, I execute two more APIs to get the text and image

$url = 'https://usercontent.googleapis.com/freebase/v1/image' . $entity_id; // to fecth image

$url    = 'https://www.googleapis.com/freebase/v1/text/' . $entity_id; // to fetch description

is there any API/URL for freebase, such that, I get all these three at once ?????

도움이 되었습니까?

해결책

You're never going to get different media types (e.g. JPEG & JSON) in the same call, but you can use the Search API output parameters to get the name, text blurb, and image URLs. The images will still need to be fetched separately.

For example, if you wanted the names and descriptions in Japanese & English as well as the images for topics which match the search term "Barack Obama" you could use a query like:

https://www.googleapis.com/freebase/v1/search?query=%22Barack%20Obama%22&indent=true&output=%28%20name%20description%3Awikipedia%20/common/topic/image%29&lang=en%2Cja

This also returns topics like his inauguration, so you could filter by type if you knew it ahead of time or do the query using the topic ID or MID if you knew them.

다른 팁

This is not possible as far as I know.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top