I am creating a node which makes a GET petition to an API and one of the requisites is to pass the credentials as a query parameter. I have no clue about how to do it. Before I was able to pass those credentials to the header succesfuly for another kind of petition, but I need help to pass it as ‘query parameters’
Thank you very much, I hope I have explained myself good enough.
You can supply it as qs on the option-object you supply the request function. n8n uses the request library under the hood. You can find the documentation here:
That worked perfectly, thank you very much @jan
But now I have another issue. What if I wanaa pass only the ‘value’ of the cedentials?
‘credentials’ : ‘value’
Can be done?
sure,
in this case the credentials are stored as key value as the following example =
‘apikey’ : ‘xxxxxxxxxxxxxxxxxxxxxxxxxx’.
But I need to pass only the value ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’ as a query string without the key, otherwise I get an error in the query.
The problem is that I don’t know how to extract just the value from a credential.
I got it already,
credentials.apikey extracts the pasword of the credentials given to the node.
where credentials is this.getCredentials(‘argument’) as IDataObject;