• This topic has 3 replies, 2 voices, and was last updated June 22, 2020 by Justin P.

Zerto Analytic API authentication bad request erro

  • Hi All,

    I am trying to collect the status of all VPG from zerto analytics API in google spreadsheet using google script .

    While running below code , getting error “Request failed for https://analytics.api.zerto.com returned code 400. Truncated server response: {“errorCode”:4,”errorMessage”:”Bad Request”}”

    Code :

    function vpgStat() {

    var Username = ‘username’;
    var Password = ‘password’;

    var API_URL = ‘https://analytics.api.zerto.com/v2/auth/token’;

    var options =
    {
    method: “POST”,

    contentType:application/json”,

    headers:{
    Authorization : “Basic” + Utilities.base64Encode(Username + ‘:’ + Password)

    },

    };
    var response = UrlFetchApp.fetch(API_URL, options);

    }

     

    Can someone help meĀ  to identify the error.

     

    Thank you in advance.

    Regards,

    Sagar

    Sagar,

    you are trying to authenticate with analytics like our zvm and zcm require you to.

    Analytics is different. It requires a Json object in the body of your request with the username and password, not in the headers.

    see here https://docs.api.zerto.com/

    Tagged: 

    Hi Justin P,

    Thank you for the help. This issue has been resolved .

    Regards,

    Sagar

    Awesome news! Let us know if you run into anything else.

    Have a great day!

    Justin

You must be logged in to create new topics. Click here to login