Get a single entry
Log in to add to favouritesCall the entries.get() method in our delivery client to get a single entry
Call signatures
get(id: string): Promise<Entry>
get(options: EntryGetOptions): Promise<Entry>
Parameters
Name | Type | Description |
---|---|---|
id | string | The id of the entry |
options | EntryGetOptions | An object specifying the id, language, fields to return and linkDepth. |
Returns
A Promise that will resolve with the Entry
Example
// Using TypeScript, or ES Module await syntax
const entry = await client.entries.get('<entry_id>');
console.log(entry.entryTitle);
// Using Common JS promise callback syntax
client.entries.get('<entry_id>')
.then(function (entry) {
console.log(entry.title);
});
Using options
Get only the title and overview fields of the French entry variation resolving linked content to a depth of 2
// Using TypeScript, or ES Module await syntax
const entry = await client.entries.get({
id: '<entry_id>',
language: 'fr-FR',
linkDepth: 2,
fields: ['title', 'overview']
});
console.log(entry.title);
console.log(entry.overview);
Get only the title and overview fields of the French entry variation resolving linked content to a depth of 2
// Using Common JS promise callback syntax
client.entries
.get({
id: '<entry_id>',
language: 'fr-FR',
linkDepth: 2,
fields: ['title', 'overview']
})
.then(function (entry) {
console.log(entry.title);
console.log(entry.overview);
});