Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searching on departmentID&hasImages #38

Open
olivierjoubert opened this issue Apr 13, 2021 · 3 comments
Open

Searching on departmentID&hasImages #38

olivierjoubert opened this issue Apr 13, 2021 · 3 comments
Labels

Comments

@olivierjoubert
Copy link

Hello,

In the context of a school project, we try to use the MET API to look for art pieces based on specific criteria

Will it is working pretty well with the examples provided in the readme such as (departmentId=6&q=cat), we keep having issues with the following request :

$response = $client->request('GET', 'https://collectionapi.metmuseum.org/public/collection/v1/search', [
'query' => [
'departmentId'=> '6',
'hasImages' => 'true',
],
]);

Or even simpler...

$response = $client->request('GET', 'https://collectionapi.metmuseum.org/public/collection/v1/search', [
'query' => [
'departmentId' => 6
],
]);

Getting the Fatal error: Uncaught Symfony\Component\HttpClient\Exception\TransportException: Server returned nothing (no headers, no data) for "https://collectionapi.metmuseum.org/public/collection/v1/search?departmentId=6&hasImages=true". in /home/olivierjoubert/Tests/connexionAPI/vendor/symfony/http-client/Chunk/ErrorChunk.php on line 65.

Any idea why ?
Any help would be appreciated.

Thanks.

@namari12
Copy link

namari12 commented May 10, 2021 via email

@ui-jb
Copy link

ui-jb commented Sep 14, 2021

Hello!

I also ran into this problem and found that the "q" property must be specified.

For example, your query works once that "q" property is provided (please note that %22 is just an encoded double quote): https://collectionapi.metmuseum.org/public/collection/v1/search?departmentId=6&hasImages=true&q=%22%22

I hope this is helpful to anybody else who has run into a similar scenario with the Met's search API 🙂

-Joe

@tanya-sv
Copy link

Hello!

I have tried using this approach (with q=""), but it seems that the final result is not correct.

For example, for departmentId=11 the search endpoint https://collectionapi.metmuseum.org/public/collection/v1/search?departmentId=11&hasImages=true&q=%22%22 returns 1595 objects ids, meanwhile, if you check on MET website, there should be 2325 results for this department (see https://www.metmuseum.org/art/collection/search?showOnly=withImage%7CopenAccess&pageSize=0&sortBy=Relevance&sortOrder=asc&searchField=All&department=11).

Is it a bug or am I missing something here?

Thanks in advance,
Tanya

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants