Mock Field Definitions
  • 05 Dec 2022
  • Dark
    Light
  • PDF

Mock Field Definitions

  • Dark
    Light
  • PDF

Article summary

Mock data is simply the response from the other system. It will typically be JSON, but it should match the datatype or responseDatatype that is defined in the action.json.

  • In this example, all the fields are unique to the response and determined by the external system.

Sample Mock Data

{
  "data": {
    "authentication": {
      "authentication-method": [
        {
          "priority": 1,
          "scope": "remote",
          "statistics": {
            "called": 2,
            "failure": 3,
            "skipped": 10,
            "success": 10
          },
          "type": "tacacs"
        }
      ]
    }
  }
}

  • There is also an older format for mock data that allows you to put status information into the response (for testing purposes, i.e. errors).
    • status: This field represents the status code that is returned from the other system. It is not part of the mock data. To test out an error, the status field can be set to an error code.
    • response: This is the object that will contain the mock data. Instead of just putting the mock data into the file, it should be added in the response object.
  • Since mock data is not an actual HTTP response, it does not contain headers to specify information such as the status of the request. Therefore, including a status can be beneficial.

Sample Mock Data

 {
  "status": 200,
  "response": { 
    "allowDelete":true,
    "alternateName":"string",
    "dateAdded":0,
    "description":"TESTING",
    "disableConcurrentPolling":true,
    "disablePolling":true,
    "disableThresholding":true,
    "id":1245,
    "ipAddress":"10.10.10.1",
    "isDeleted":true,
    "isNew":true,
    "lastDiscovery":0,
    "name":"Michael1",
    "numElements":0,
    "pluginManagerId":0
  }
}

Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.