- 
      
 - 
        
Save plugn/cd3cceeab6ec6f2f6d45093489bf81e6 to your computer and use it in GitHub Desktop.  
    contentful API // http://jsbin.com/lopovo
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>JS Bin</title> | |
| <script src="https://unpkg.com/contentful@latest/browser-dist/contentful.min.js"></script> | |
| </head> | |
| <body> | |
| <script id="jsbin-javascript"> | |
| var SPACE_ID = 'ww0oai7kx4lu' | |
| var ACCESS_TOKEN = 'ec24b6347a5d0bf45e5e69a2d6793a3e88c59d9bf5892f4e7e72185171b7992e' | |
| var client = contentful.createClient({ | |
| space: SPACE_ID, | |
| accessToken: ACCESS_TOKEN | |
| }) | |
| client.getEntries() | |
| .then(function (entries) { | |
| // log the title for all the entries that have it | |
| entries.items.forEach(function (entry) { | |
| if(entry.fields.image) { | |
| console.log(entry.fields.image.map(function(img){ | |
| return img.fields.file.url | |
| })) | |
| // console.log(entry.fields.image[0].fields.file.url) | |
| } | |
| }) | |
| }) | |
| </script> | |
| <script id="jsbin-source-javascript" type="text/javascript">var SPACE_ID = 'ww0oai7kx4lu' | |
| var ACCESS_TOKEN = 'ec24b6347a5d0bf45e5e69a2d6793a3e88c59d9bf5892f4e7e72185171b7992e' | |
| var client = contentful.createClient({ | |
| space: SPACE_ID, | |
| accessToken: ACCESS_TOKEN | |
| }) | |
| client.getEntries() | |
| .then(function (entries) { | |
| // log the title for all the entries that have it | |
| entries.items.forEach(function (entry) { | |
| if(entry.fields.image) { | |
| console.log(entry.fields.image.map(function(img){ | |
| return img.fields.file.url; | |
| })) | |
| } | |
| }) | |
| }) | |
| </script></body> | |
| </html> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var SPACE_ID = 'ww0oai7kx4lu' | |
| var ACCESS_TOKEN = 'ec24b6347a5d0bf45e5e69a2d6793a3e88c59d9bf5892f4e7e72185171b7992e' | |
| var client = contentful.createClient({ | |
| space: SPACE_ID, | |
| accessToken: ACCESS_TOKEN | |
| }) | |
| client.getEntries() | |
| .then(function (entries) { | |
| // log the title for all the entries that have it | |
| entries.items.forEach(function (entry) { | |
| if(entry.fields.image) { | |
| console.log(entry.fields.image.map(function(img){ | |
| return img.fields.file.url | |
| })) | |
| // console.log(entry.fields.image[0].fields.file.url) | |
| } | |
| }) | |
| }) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment