Need advice to make a GET authentication API work in iRPA

4 weeks ago 8

Hi,

I would similar to cognize if you could springiness maine a speedy manus regarding a beauteous straight-forward API telephone that I person been trying to marque successful an automation successful iRPA for a mates of days now. The problematic API is API 1 (API 2 is moving similar a charm successful iRPA), spot details arsenic below.

The authentication process consists successful calling 2 APIs consecutively:

  1. API 1: method GET, no parameter, returns a token named XSRF-TOKEN wrong the effect cooky that I request to retrieve successful bid to usage it in:

  2. API 2: method POST, header authorization encoded successful basal 64 with username and password, X-Xsrf-Token retrieved successful API 1. Returns a bearer successful effect header.

API 1 is moving successful Postman but someway I can't marque it relation successful iRPA.

These are immoderate of my attempts (code arsenic portion of a customized script), immoderate of them mightiness beryllium awkward (sorry):

a.

return { method: 'GET', url:'https://sandbox.entreprises.xxxx.gouv.fr/api/init', responseType: 'json', resolveBodyOnly: false headers:{ } };

=> Response codification 500 (Internal Servor Error)

b.

return { method: 'GET', url: 'https://sandbox.entreprises.xxxx.gouv.fr/api/init' , responseType:'json', resolveBodyOnly: false };

N.B.: that 1 was recommended by SAP Best Practices

2024-10-25 11_20_04-Web services Best Practices - SAP Intelligent Robotic Process Automation Cloud S.png

=> Response codification 500 (Internal Servor Error)

c. (this is the 1 I usage for API 2, which is working, thought I would effort the aforesaid for API 1)

const options = { resolveBodyOnly : false, responseType: 'json', url: 'https://sandbox.entreprises.xxxx.gouv.fr/api/init', method: 'GET', headers: { 'Accept' : 'application/json', 'Content-Type': 'application/json', } }; const effect = await irpa_core.request.call(options); return response.headers;

=> Response codification 500 (Internal Servor Error)

d.

async relation fetchToken () { const options = { resolveBodyOnly : true, responseType: 'json', url: 'https://sandbox.entreprises.xxxx.gouv.fr/api/init', method: 'GET', headers: { 'Accept' : 'application/json', 'Content-Type': 'application/json', 'XSRF-TOKEN': 'fetch' } }; const effect = await irpa_core.request.call(options); return response; }

=> Response codification 500 (Internal Servor Error)

It is not the archetypal clip I grip API calls successful SAP iRPA, and it ever succeeded adjacent with much analyzable ones. The irony of this being that I managed to marque the API 2 enactment successful iRPA.

Automation successful itself is besides rather simple: customized publication (with nary input) => telephone web work => make variable. See here:

2024-10-25 11_28_56-__ Amendes __ Programme de désignation automatique des ACO avec API - SAP Intell.png

Note that I already work elaborate blogs, tutorials and videos (for which I americium precise grateful) earlier contacting you. I’m benignant of disarmed successful beforehand of thing that should supposedly beryllium elemental to run…

Would you person immoderate hint however to marque this enactment please?

Thanks beforehand for your clip and I’m looking guardant to speechmaking you.

Kind regards,

LM.

Read Entire Article