Skip to content

Instantly share code, notes, and snippets.

@erwan
Last active August 29, 2015 14:06
Show Gist options
  • Save erwan/f3f7d4b970e964131271 to your computer and use it in GitHub Desktop.
Save erwan/f3f7d4b970e964131271 to your computer and use it in GitHub Desktop.
Prismic.Api('https://lesbonneschoses.prismic.io/api', function (err, Api) {
Api.form('everything')
.ref(Api.master())
.query(Prismic.Predicates.at("document.type", "product")).submit(function (err, response) {
if (err) {
console.log(err);
done();
}
// The documents object contains a Response object with all documents of type "product".
var page = response.page; // The current page number, the first one being 1
var results = response.results; // An array containing the results of the current page;
// you may need to retrieve more pages to get all results
var prev_page = response.prev_page; // the URL of the previous page (may be null)
var next_page = response.next_page; // the URL of the next page (may be null)
var results_per_page = response.results_per_page; // max number of results per page
var results_size = response.results_size; // the size of the current page
var total_pages = response.total_pages; // the number of pages
var total_results_size = response.total_results_size; // the total size of results across all pages
});
});
@scottsb
Copy link

scottsb commented Nov 12, 2014

You're missing the closing brace on the inner if statement.

@erwan
Copy link
Author

erwan commented Dec 15, 2014

This is correct, thank you for the heads up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment