Error 401 when calling REST API from a GEL script
search cancel

Error 401 when calling REST API from a GEL script

book

Article ID: 224622

calendar_today

Updated On:

Products

Clarity PPM On Premise Clarity PPM SaaS

Issue/Introduction

When trying to use REST API through a GEL script, I get Error 401 (Unauthorized).

See the following link for an example of a Gel script calling the REST API

Gel script calling REST API

Environment

All current Clarity releases.

Resolution

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 SSO 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.

Also, ensure that the user is 'Active' (i.e.: not 'Locked' nor 'Inactive').

 

If you are using SSO then you will need to create an API key and use BEARER authentication to succeed.

Additional Information

The following documentation has more information about API Keys.