Using confluence rest api in my jira service management app

I’m currently working on a Jira Service Management app and looking to use the Confluence API to retrieve pages. However, I’ve encountered a challenge where the logs indicate that the pages object is undefined . I’m seeking assistance in resolving this issue,btw its working when i try it using postman

this is my code :


resolver.define('getPages',async(req)=>{

  try{
    const res=await api.asApp().requestConfluence(
      route`/wiki/api/v2/pages`,
    {
    headers:{
     'Accept': 'application/json',
     'X-ExperimentalApi':'opt-in'
 
    },
   })
   const data=await res.json();
   console.log(data)
   console.log(`pages: ${data.results}`)
   return data.results;
  }
 catch(err){
  console.error('Error fetching articles:', error);
}


});

the manifest :
permissions: scopes: - read:servicedesk-request - read:page:confluence - read:confluence-space.summary - read:confluence-content.all - read:confluence-content.summary

That is weird, we are doing more or less the same things successfully.
Have you tried without the header 'X-ExperimentalApi':'opt-in' ?

yes, are you calling the confluence api from a jira service management app?