What is the best way to retrieve data from multiple pages of a JSON API in one go?

Why am I only receiving the first page out of 61 pages in this json file with my current call? How can I retrieve all of them? Is there a way to use axios in a loop or another method?

  <template>
  <div id="app">
    
      <thead>
     
      </thead>
      <tbody>
      {{items}}
      </tbody>

  
  </div>

</template>

<script>
import axios from 'axios';

export default {
  data() {
    return {
      items:[]
    }
  },


  created() {
    axios.get(`https://zbeta2.mykuwaitnet.net/backend/en/api/v2/media-center/press-release/?page=2&page_size=12&type=5`)
    .then(response => {
     
      this.items = response
    })
    
  }
}

</script>

Answer №1

Experiment with excluding the query string

?page=2&page_size=12&type=5
:

axios.get(`https://zbeta2.mykuwaitnet.net/backend/en/api/v2/media-center/press-release/`)

Alternatively, you can specify how many articles per page you wish to fetch (in this scenario, 61 pages with 12 articles each):

axios.get(`https://zbeta2.mykuwaitnet.net/backend/en/api/v2/media-center/press-release/?page=1&page_size=732&type=5`)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to iterate through a JSON object and display its values?

When I receive JSON data from an API, it looks like this: callback({"Message":"","Names”:[{“id”:”16359506819","Status":"0000000002","IsCurrent":true,"Name":"JAKE"," ...

Sending an AJAX request will only transmit a portion of an array when using the JSON.stringify

I have a JavaScript array that is constantly updated. Here's how I initially set up the array... columnArray = ["userID", "Date", "trialType", "cue", "target", "response", "accuracy", "lenAcc", "strictAcc", "fkpl", "totalTime"]; var dataArray = []; ...

Transforming a map into JSON with Playframework

How do I convert a map (defined in a scala template file) with the following structure: <Integer, Map<Integer, Double>>, to a JSON string? I have attempted to use the following code snippet: @Json.stringify(Json.toJson(moduleId2DecileMap)) H ...

Is it possible to implement H-Screen in Tailwind without causing the page size to expand? My website has a fixed navbar at the top, and I

My setup includes PanelMaster, along with Panel 1 and Panel 2 components. PanelMaster: flex Panel1: flex-col Panel2: flex-col I have a Navbar component at the top of the page with 'h-1/5' applied to it. However, I'm facing an issue where ...

"Unlocking the hidden powers within a directive: A guide to accessing inner

I have two directives called container and item. directive('container', function(){ return { replace: true, template: "<div>contains <p>...</p> </div>' } }); directive('item', fun ...

Trouble with AngularJS ui-router: template fails to show up

I have been diving into a tutorial on egghead.io that delves into application architecture, tweaking certain components to fit my specific application needs. Just a heads up, I am relatively new to Angular, so I'm hoping the issue at hand is easy to ...

How to populate a database with Facebook data by utilizing AJAX post and PHP

I've been developing a Facebook Canvas game and had it running smoothly on my localhost along with a local database via phpMyAdmin. However, after moving it online, I've encountered an issue with the database. Previously, the game would grab pla ...

Is it possible to switch between different fabricJS canvases seamlessly?

Consider this scenario where I have three canvas elements: <canvas id="c1" width="400" height="300"></canvas> <canvas id="c2" width="400" height="300"></canvas> <canvas ...

Update the link by simply clicking on a div tag

I am currently working on a PHP page and my goal is to add the extension ?id=variable_value to its URL when I click on a specific div. However, whenever I try to do this, it shows me an error message stating that the URL with the extension is undefined. B ...

Show a pop-up notification when the mouse passes over a word in the text

I've been grappling with this issue for days now and could really use some guidance. Despite scouring the web, I'm unsure if I've approached it correctly. What I'm trying to achieve is having an alert box pop up each time a user hovers ...

How to convert JSON data to CSV using a for loop in Python

Does anyone know how to correct my formatting issue? I have figured out how to retrieve the header and export the data in json format to a file. The challenge I'm facing is assigning the item index to each line in every column. data = json.loads(res ...

Error: Unable to access the value property of a null object (React/JS/TS)

I created a function that dynamically determines the background color based on a specific value. const backgroundColorResolver = () => { allQuestions.map((aq) => { if (aq.averageAnswerValue <= 4) return "#EE7362"; if (a ...

Error message "Unable to create schema document" encountered on WCF documentation page

I am using a Rest API (WCF Net 4.0): [ServiceContract] interface ISubscriptionService { [OperationContract] [WebInvoke(Method = "GET", UriTemplate = Routing.ProductsRoute, BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Jso ...

Tips on linking a changing object using v-bind in Vue

Can someone help me with a query regarding the v-bind dynamic object? When dealing with binding in a completely dynamic object, how can I bind properties using operation expressions? How can I ensure that the attributes stay observable and update automatic ...

Unable to Access ReactJS Nested Property in JSON Data

While attempting to access a nested property in my JSON file loaded into the state, I encountered an issue. Despite confirming the existence of the property within the object through logging, when trying to navigate a level deeper using dot-notation, an er ...

How can one go about constructing abstract models using Prisma ORM?

Among my various prisma models, there are common fields such as audit fields like created_at and updated_at. model User { id Int @id @default(autoincrement()) created_at DateTime @default(now()) updated_at DateTime @updatedAt email ...

When sending multiple JSON objects in an HTTP POST request to an ASP.NET MVC controller action, they may not be properly bound

I am passing two JSON objects to an ASP.NET MVC controller action, but both parameters are showing as null. Can anyone identify the error, possibly related to incorrect naming? /* Source Unit */ var sourceParent = sourceNode.getParent(); var sourceUnitPa ...

The React Component is caught in a loop of continuous re-rendering and reloading

Just starting out with React and tackling my first project. Running into a bit of trouble here, so I'm sharing my code for some insight. When users input their search term and hit 'search,' they are redirected from another page to this one. ...

Ensure that the if statement is appropriate for matching the Textarea and Div elements

When I click on an element within the removeFood division, I expect it to correspond with the item in the text area named newFoodName1. $(".removeFood").click(function() { var removedFood = ($(this).children('.dailyItem').text()) $(this).t ...

Guide to Sending Form Data from Vue.js to Spring Boot

I am looking to submit form data from Vue to Spring Boot. Are there any recommendations on how to do this effectively? Below is the structure of my project: .mvn .vscode frontend - Vue Project src - Spring Boot src target .gitignore ... In Registe ...