Title: API Assistance
Last modified: August 25, 2020

---

# API Assistance

 *  [lgehrig4](https://wordpress.org/support/users/lgehrig4/)
 * (@lgehrig4)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/api-assistance/)
 * I’m just learning about the WordPress API and I found this code that works for
   what I’m looking to do. I need to pull all of the portfolio posts to display 
   the excerpts. Problem is that this doesn’t load all of the posts, There are over
   100 and I’m getting about 10. I’m not getting any errors in the console so I 
   really don’t know where to start troubleshooting.
 *     ```
       function getExcerpt() {
         var ourRequest = new XMLHttpRequest();
         ourRequest.open('GET', 'https://equipourkids.org/wp-json/wp/v2/portfolio');
         ourRequest.onload = function () {
           if (ourRequest.status >= 200 && ourRequest.status < 400) {
             var data = JSON.parse(ourRequest.responseText);
   
             for (i=0; i < data.length; i++) {
               console.log(data[i].excerpt)
             } 
           } else {
             console.log("We connected to the server, but it returned an error.");
           }
         };
   
         ourRequest.onerror = function () {
           console.log("Connection error");
         };
         ourRequest.send();
       }
       getExcerpt()
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Samuel O.](https://wordpress.org/support/users/wpcoworker/)
 * (@wpcoworker)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/api-assistance/#post-13307894)
 * That must be because of the value set under “Settings > Readings > Blog pages
   show at most”.
 * For API you will need to use per_page, page & offset parameters. Please check
   this for more info – [https://developer.wordpress.org/rest-api/using-the-rest-api/pagination/#pagination-parameters](https://developer.wordpress.org/rest-api/using-the-rest-api/pagination/#pagination-parameters)
 *  Thread Starter [lgehrig4](https://wordpress.org/support/users/lgehrig4/)
 * (@lgehrig4)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/api-assistance/#post-13308230)
 * That makes sense [@wpcoworker](https://wordpress.org/support/users/wpcoworker/).
   I’ll check this out tomorrow. thanks

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘API Assistance’ is closed to new replies.

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 2 participants
 * Last reply from: [lgehrig4](https://wordpress.org/support/users/lgehrig4/)
 * Last activity: [5 years, 9 months ago](https://wordpress.org/support/topic/api-assistance/#post-13308230)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
