cancel
Showing results for 
Search instead for 
Did you mean: 

oData get method error in SAP IRPA Cloudstudio?

02-28-2022 1:51 PM
ramya_t123 Discoverer
711 views 2 comments
0 Likes
SAP Managed Tags
Subscribe

Hello,

Here we are trying to get oData service with authentication in irpa cloud studio, we tried to use this piece of code
For credentials we used "Encode string"
async function fetchToken() {

const options = {

resolveBodyOnly : false,

method: 'GET',

url: " OUR URL ",

headers: {

'Accept' : 'application/json',

'Content-Type': 'application/json',

'Authorization' : 'Basic ' + credentials,

'x-csrf-token': 'fetch'

}

};

try {

const response = await irpa_core.request.call(options);

return response;

} catch (error) {

const csrfToken = error.response.headers['x-csrf-token'];

return error;

}

}

let response = await fetchToken();

return response.headers;

But we are getting error as "Cannot read property 'headers' of undefined". How to resolve this issue and also how to read odata service with authentication?


Thanks,
Ramya.T


0 Likes

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Likes

I am also getting the same error, Can you please help me how to solve this error.

TJe
Product and Topic Expert
Product and Topic Expert
0 Likes

Can you please try to debug and/or write the error.response to the console.
Also please check that you are using the latest irpa_core SDK (update your dependencies in your project)

hope this helps, regards Thomas