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

Query entries get response Bad Request #7

Closed
iprognos opened this issue May 25, 2015 · 3 comments
Closed

Query entries get response Bad Request #7

iprognos opened this issue May 25, 2015 · 3 comments

Comments

@iprognos
Copy link

I tested the contentful entries query:

Failed to load resource: the server responded with a status of 400 (Bad Request)
https://cdn.contentful.com/spaces/1jdsnorf6e9t/entries?access_token=02d0e52b0cfb62cb9fc011cfe849191fd58a9abb285a388afd68720cf9ab1df7&content_type=category

I switched from dog to category because I don't have dogs in my blog, other then that, I used it this way:

ul contentful-entries="content_type=dog"
li ng-repeat="dog in $contentfulEntries.items"
{{ dog.fields.name }}
/li
/ul

I have also tried with CURL and followed the documentation: https://www.contentful.com/developers/documentation/content-delivery-api/http/#search-content-type.

curl -X GET -H 'Authorization: Bearer 02d0e52b0cfb62cb9fc011cfe849191fd58a9abb285a388afd68720cf9ab1df7' 'https://cdn.contentful.com/spaces/1jdsnorf6e9t/entries?content_type=category';
{
"sys": {
"type": "Error",
"id": "InvalidQuery"
},
"message": "The query you sent was invalid. Probably a filter or ordering specification is not applicable to the type of a field.",
"details": {
"errors": [
{
"name": "unknownContentType",
"value": "DOESNOTEXIST"
}
]
},
"requestId": "c0e-1773132314"
}

Maybe only dogs is searchable...

@iprognos
Copy link
Author

Strangley I was able to filter by doing: query=all, then I get 3 entries instead of all posts, categories and authors. But this is not good enough.

@iprognos
Copy link
Author

Maybe contetful is not production ready and is not meant for building blogs?

@jvandemo
Copy link
Owner

@iprognos — When querying the Contentful API you must use the content type ID.

Try this:
https://cdn.contentful.com/spaces/1jdsnorf6e9t/entries?access_token=02d0e52b0cfb62cb9fc011cfe849191fd58a9abb285a388afd68720cf9ab1df7&content_type=5KMiN6YPvi42icqAUQMCQe

where 5KMiN6YPvi42icqAUQMCQe is the id of your category content type.

You can see al content types using:
https://cdn.contentful.com/spaces/1jdsnorf6e9t/content_types?access_token=02d0e52b0cfb62cb9fc011cfe849191fd58a9abb285a388afd68720cf9ab1df7

I would really recommend reading through the entire content delivery API documentation here: https://www.contentful.com/developers/documentation/content-delivery-api/

Can you let me know if it works so I can close this issue? Thanks!

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

No branches or pull requests

2 participants