ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

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

Environment

  • Release : 15.9.1
  • Component : CLARITY XML OPEN GATEWAY (XOG)

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

Additional Information

The following documentation has more information about API Keys.