How to call restful APIs using external programs with static access token

Hi

there are some requirements that should make some integration with MES and other external systems or programs using Restful API.

But we got issues on access token with Bear authorization.

Generally, we used the token which extracted from HTTP request on browser like below

and it works, — ignored 503 error. :slight_smile:

BUT, this token will be expired after few minutes. so we want to get a static token to request API.

so we tried to use User Access Token, but got 401 Unthorization error like below

using this User Access Token

So, is there any other way to request with unexpired token?

Thanks.




Hi,

you are using Bearer authentication with a PAT - that does not work.

When using a PAT (User Access Token) you need to change that to ‘Basic’. Then it should work.

Depending on your implementation, you might need to add a “:” (without the quatation marks) at the end of the PAT to authenticate.

All the best,
Maximilian

ok, it works. Thanks.

Hi,That is correct, but to improve your application security, you should use oauth2 authentication as described in the following tutorial (on the CM Developer Portal):Authentication Portal Regards,João Moreira