Closed JSkally closed 9 years ago
Yap, as described in the documentation you need to pass the class to the fetch()
method, e.g.:
client.fetch(Asset).all()
client.fetch(Entry).all()
client.fetch(ContentType).all()
@JSkally please comment on whether or not your issue is resolved.
@tomxor wouldn't that require me to setup a class before. Suppose I want to get all the content types beforehand like in the Android SDK where it sends over each content type as an object which would then allow me to setup the necessary classes.
I'm not sure if I completely understand what you mean, could you provide an example?
Or perhaps I do :) Classes: Asset
, ContentType
and Entry
are built-in the SDK, you simply need to import those first, e.g:
from contentful.cda.resources import ContentType
for ct in client.fetch(ContentType).all():
print(ct.fields)
Check out the official documentation for the resources
module.
@tomxor PERFECT thanks
Sure, glad I could help.
is there some way to do this like:
client.fetch('content_types').all()
orclient.fetch('entries').all()
orclient.fetch('assets').all()
that returns an array of the preexisting content types with their fields and such?