When tyring to use REST API through a Gel Script, error 401 is being obtained. The sample script mentioned in Knowledge Document 218785 is being used.
The script is only a sample and the issue lies with the hardcoded value for Authorization header.
<core:arg value="Authorization" type="java.lang.String"/>
<core:arg value="Basic YWRtaW46YWRtaW4=" type="java.lang.String"/>
In the example the value is for username/password as admin/admin.
If you are not using any SSO service then you can navigate to any online Base64 encoder and encode the username and password in the format username:password. Note :- the colon is also part of the string.
Once that's encoded replace the value and try again.
If you are using SSO then you will need to create an API key and use BEARER authentication to succeed.
The following documentation has more information about API Keys.