Calling OAuth 2.0 API call on schedule using Postman Monitor - api

I have to schedule an API call which is Oauth 2.0 authenticated.
If I run the API call manually by accessing the token on Postman, the API call gets successfully hit.
Now I want to schedule this API call to monitor its response time and check whether it is up or not.
So, I used Postman monitor for it and added a collection which has OAuth details as well as the request. But somehow monitor is not working and it is throwing Unauthorised error.
I want to know what am I missing in Postman monitor to schedule the API or Is there any tool or method available for free where I can schedule API call and get the email notification on its failure.

Related

401 Error When Making Basic Authenticated API Calls to X2CRM

We are encountering a 401 error when making basic authenticated API calls to the X2CRM endpoints (index.php/api2/Contacts). Unauthenticated API calls to other X2CRM VoIP endpoints are successful without issue, and basic authentication works on a test page in the same directory using the same PHP-FPM pool. API calls previously working successfully.
The problem is that API calls to index.php/api2/Contacts or similar endpoints in the X2CRM system are returning a 401 error with "missing user credentials." Basic authentication is working correctly on a test page in the same directory and using the same PHP-FPM pool, and unauthenticated API calls to other X2CRM voip endpoints index.php/api/voip/data/(phone number) are successful without issue. The credentials for the API calls are confirmed to be present in the database
We tried making basic authenticated API calls to the X2CRM endpoints (index.php/api2/Contacts, etc.) using Postman and cURL. We expected the API calls to be successful and return the expected data. However, we encountered a 401 error and the response stated "Missing user credentials". We confirmed that the credentials being used are valid and present in the database. We also tested a basic authentication on a test page in the same directory and it was successful, allowing entry into the directory. We need help resolving the issue with the basic authenticated API calls.
The response that you have shared
Missing user credentials
means that the credentials that you are trying to send are not being sent with the request.
If those credentials were being sent correctly, then, the error would have been:
Invalid user credentials
or, something else in the response.
Furthermore, the index.php/api is different from index.php/api2 so you will need to verify it in the api2 controller. You can send a request to the following Endpoint to verify if your credentials work with the builtin APIs:
https://<YOUR_CRM_DOMAIN>/index.php/api2/appInfo.json
Moreover, the documentation clearly indicates that 401 error is related to Authorization, so you will need to fix that first.

How to manage a JWT login procedure from Micronaut client to a REST API?

I am new to Micronaut and trying to develop a gateway that connects on the client side to a REST API. The API requires an authentication token which is obtained by first sending a POST requests with credentials in the body. The API is then responding with a valid token which needs to be refreshed from time to time. I am able to inject a bearer token in the headers to authenticate my requests but I do not understand whether I have to handle the whole authentification process myself or if the Micronaut framework can manage it on its own?
Thank you very much for your help.
You could create an HttpClientFilter to handle authentication, refresh and the header. You can find an example here which cover basic authentication.
Yours will be more complicated since you need to refresh etc.
Also doing this way, allow you to decouple your authentication code from your API.

Trello OAuth 1.0 authentication

I was trying to integrate the Trello authentication flow for a server side application (using Java).
Now If I do the OAuth dance manually I'm able to get the OAuth access token and I can make API calls (so far so good).
BUT when using in production the callback POST to my server does not carry the oauth_token and oauth_verifier or code query string parameters ... instead it delivers the token as a URL fragment
http://example.com/rest/callback#token=32849234
This is useless for a server side application as fragments are omitted by the browser and are never recieved on the backend side.
So I'm not able to perform the last step - getting the access token!
Now is there a way to get the OAuth callback to call my server the correct way (as specified), the two provided options postMessage and fragment will not work for a server side implementation.
I have read:
https://developers.trello.com/authorize
https://trello.com/c/fD8ErOzA/26-getting-a-user-token-and-oauth-urls
and it seems other developers have similar issues.
Now I can make the user copy past the verification code manually ... but this is not user friendly.

Slack OAuth 2.0 without human (Add to Slack button)

Before I am able to get a token, Slack wants a user to give permissions to my request like described here:
Slack OAuth 2.0
Is it possible to get a token without any human?
I would like to make my program posting modifications of another program to a special Slack channel. But if the user has give permissions everytime, he also could post the modification to slack himself and the Slack API is not useful anymore.
No, this is not how it works. You only have to run through the OAuth process once (per Slack team) to receive the access token. The received access token remains valid and should be stored for future use.
If you want to use a Slack app and all the features it enables (e.g. Interactive buttons, Events API), you will have to run the OAuth process. However, if you only want to call a few API methods there is an alternative. You can get a so called "test token" for your Slack team which will also work and which you can get here. However, this token is meant for testing and development and not supposed to be used in production level apps.

api created in wso2 appfactory preview api publisher is not working

I created api from WSO2 appfactory preview api publisher. But when I call it from REST client it says the service doesn't exists where in yahoo weather api in the same api store gives OAuth error (which is expected without a token). The backend service runs nicely.
"404Status reportNot FoundThe requested resource (/usdToLkr/0.0.2) is not available."
My API is given here
http://apimanager.appfactorypreview.wso2.com:8280/usdToLkr/0.0.2
What I am doing wrong?
Is it blocked in appfactory preview?
First of all, if you create an API, you have to publish it by publisher.
Then you have to login from WSO2 Appfactory preview and via resources page, you should click on subscribe to API and login to API store via that.
Then you have to first subscribe to the particular API via your created application.
Then the consumer and application keys should be generated manually or automataically once you click on the Renew API keys or API button.
Then if you have provided a working production/sandbox URL during the API creation, it should work.
If you try out with the REST client, you should provide required header values. You get an OAUTH error because you havent provided the token.
A working API invocation sample for App factory preview can be seen from this documentation.
Using REST client to test an API can be seen from this documentation.
Are you looking for an online API management / gateway solution? If so, you should use WSO2 API Cloud instead.
Also, see the tutorials covering the scenarios you mentioned here.