Get a single entry
Created by Richard Saunders, last modified by Alex Pop on 04 May 2018
Requesting an individual entry can be achieved by using the get method on the client's entries property.
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 entry id
<h1 id="film_title"></h1>
<p id="film_overview"></p>
(function(Zengenti) {
// Create a client
var client = Zengenti.Contensis.Client.create();
$(function() {
var movieId = 'd11315cb-4278-455b-84bb-04698db0ebd2';
// Get the default language variation of the film
client.entries.get(movieId).then(function(film) {
// display the film's title and overview
$('#film_title').text(film.title);
$('#film_overview').text(film.overview);
}, function(error) {
console.error(error);
});
});
})(Zengenti);
Example - using entry get options
<h1 id="film_title"></h1>
<p id="film_overview"></p>
(function(Zengenti) {
// Create a client
var client = Zengenti.Contensis.Client.create();
$(function() {
var movieId = 'd11315cb-4278-455b-84bb-04698db0ebd2';
// Get the French variation of the film with a link depth of 2
client.entries.get( { id: movieId, language: 'fr-FR', linkDepth: 2, fields: ['title', 'overview'] }).then(function(film) {
// display the film's title and overview
$('#film_title').text(film.title);
$('#film_overview').text(film.overview);
}, function(error) {
console.error(error);
});
});
})(Zengenti);