Foglight REST API - Authentication error - "Method Not Allowed"

Hi,

I am trying to access Foglight using REST API but it is throwing error "Method Not Allowed". 

Details:

I have Administrator and API access on my user. I tried with http://<server>:<Port>/api/v1 and it is returning response (in Browser and Postman client) but when i tried with http://<Server>:<Port>/api/v1/security/login?authToken=<authToken> it throws an error as "Method Not Allowed".

Since I am new to Foglight, need to understand if I am missing any configuration at Foglight Side OR am i doing this incorrectly?

Followed the Article: https://www.quest.com/community/blogs/b/performance-monitoring/posts/foglight-api---0-to-100-mph-in-2-demos?CommentId=6a22250e-85c0-4d1e-adc5-f9b59a7a05de but with no luck.

Any Help would be much appreciated.

Regards, Ravi

  • Hi Ravi,

    What kinds of method(GET, POST etc) do you use for "login" API? The "login" API only support "POST" method, if you try it with other method(like "GET"), it will return "Method Not Allowed".

  • While using Postman, i used POST method but still it is throwing error "Method Not Allowed"

    While using browser, i simply put the above URL in address box.

    regards, Ravi

  • Hi Ravi,

    For a user use Foglight RestAPI, you need have following

    1. Create AuthToken for that user
    2. That user must have API access rule in Foglight

    This is good doc you can read https://www.quest.com/community/blogs/b/performance-monitoring/posts/foglight-rest-apis-introduction---java-and-python-sample-code-1237861345

    And this is mt  postman setup

    Hope this helps

    -Lee

  • Finally it is working. thanks for all help and pointers shared with me which helped me to learn a lot and make it work.

    For rest of community users (like me :) ) below are the issue and resolution.

    From the Quest REST API documentation, 

    • I didn't find what all supported headers should be there in PERL code to support the REST Call.
    • No where was mentioned that authToken OR user/password need to be supplied as Request Body/Content.
    • May be i missed in those things in documentation or due to as i have limited knowledge with Quest and PERL Slight smile

    Anyway, I tried POSTMAN and downloaded the QUEST collection and started working on it and then came to know about above issues and corrective actions and it worked afterwards. For community users, below is the short code for authentication:

    use REST::Client;
    use JSON qw(decode_json);
    use Data::Dumper;
    my $client = REST::Client->new(host => 'https://<Your Host>:<APIPort>/api/v1');
    $req = "authToken=<Authentication Token Value>";
    $headers = {
    Accept => '*/*',
    'Content-Type' => 'application/x-www-form-urlencoded',
    };
    $client->getUseragent()->ssl_opts(verify_hostname => 0);
    $client->getUseragent()->ssl_opts(SSL_verify_mode => SSL_verify_NONE);
    $client->POST('/security/login',$req,$headers);
    print($client->responseCode());
    print($client->responseContent());
    exit();