Advanced Type Retrieval
This is a simple how to on different aspects of the Contentful JAVA API. All following samples assume a client setup like
as described in our getting started guide.
All entries
To fetch all entries of the given space, you could use:
This will result in
One specific entry
Using the .one(<YOUR_ITEM_ID>) method of the client, like follows
you’ll get a response like
All assets
Retrieving all assets of a space, this snippet could help:
And this will be the result for a different (space = cfexampleapi, token = b4c0n73n7fu1) sample space…
Only one asset
Retrieving one specific asset, take a look at this example:
And this will be the result in only one asset (again using the cfexampleapi space):
Content types
In order to request all content types, you could use a call like this:
Taking the resulting object, it’ll be printed as (This example will only contain one content type, since the space only contains one type).
Fetching details of the current space
To fetch the current space meta information, you could use
yielding
Fetching all spaces
For this example, you will need to get a CMA API token and create a CMAClient using it:
And the result will be: