Unable to create a webdriver monitor using the RESTAPI.
search cancel

Unable to create a webdriver monitor using the RESTAPI.

book

Article ID: 280160

calendar_today

Updated On:

Products

CA App Synthetic Monitor

Issue/Introduction

Attempting to use the swagger UI to create a webdriver monitor. They get a Forbidden error (403). Creating an HTTPS monitor seems to work fine for them. Could there be something wrong in the request format?

Below is the request being used:

 

{
    "name": "Test Handshake Monitor",
    "folderId": <folderid>,
    "maintenanceGroupIds": [],
    "tagNames": [],
    "transactionTag": "",
    "userNote": "",
    "check": {
      "mode": 4,
      "interval": "00:05:00",
      "periodFrom": "00:00",
      "periodTo": "23:59",
      "days": [
        0,
        1,
        2,
        3,
        4,
        5,
        6
      ]
    },
    "alert": {
      "timeWarn": 5000,
      "timePoor": 10000,
      "timeOut": 60,
      "alertAfter": -1,
      "dontDoPostMortem": false,
      "contactId": null,
      "notifyWhenUp": true,
      "quietPeriod": null,
      "checkThreshold": 1
    },
    "checkpoint": {
      "usePublic": false,
      "groupIds": [
     <groupid1>
      ],
      "algorithm": "random",
      "defaultGroupId": null
    },
    "noScheduleOnMaintenance": false,
    "noRescheduleOnFailure": false,
    "applicationId": null,
    "type": "webdriver",
    "scriptFile": {
      "scriptId": <scriptid>,
      "contentArchive": null,
    "parameters": "url=https%3A%2F%2Fwww.example.com",
      "stages": null,
      "content": null
    },
    "host": "www.example.com",
    "useProxy": false,
    "username": null,
    "password": null,
    "elemErrorReport": false,
    "toggleQuiescence": false,
    "browserRestriction": "everywhere",
    "browserAllow": "",
    "browserDeny": null,
    "proxyExcludeHosts": null,
    "remapHosts": null,
    "blockHtml5Media": false,
    "userAgent": "",
    "browser": "chrome:110.0",
    "authenticationType": "none",
     "requestHeaders": "string",
    "jsErrorReport": false,
  "checkCertificate": true,
  "postVariables": "string",
  "ipVersion": 0,
  "matchString": "String that must be present"  
  }

Resolution

The 403 error means you are using something that you cannot access. Are you authenticated? You must provide either API credentials or a token (there are 2 types of tokens). If logged in to the ASM UI it doesn't mean automatically being logged in the APIv3. The token is always bound to a user (the token owner) and bears the permission of that user.

 

Please share which user is creating the monitor (who is owner of that token)? Is it the account owner or some of the subaccounts? The problem might be the user has no permission to create monitors in a specific folder.

When using the swagger UI, you should get detailed error description. If the message is as simple as "Forbidden" they most likely did not use any token at all.

 

Also, you are trying to reuse an existing script  from another webdriver monitor. This is not possible. You can only upload a new script or reuse a script that is not used by another monitor (e.g. the previous version of the script). Scripts cannot be shared among monitors.. This would trigger 400 (bad request) error.