Odo REST API - groupon/odo GitHub Wiki

General API supported by configuration interfaces

Terminology

  • {profileIdentifier} - Name or ID of the profile to edit (Ex: My%20Profile)
  • {pathIdentifier} - Name or ID of the path to edit (Ex: My%20Path)
  • {clientUUID} - UUID of the profile client to update, -1 is the default client (I know this is not a UUID)

Create Profile Client

POST /testproxy/api/profile/{profileIdentifier}/clients
{
	"client": {
		"id": 4,
		"isActive": false,
		"uuid": "5555-555-5555-5555",
		"profile": {
			…. profile information goes here
		}
	}
}

Delete Profile Client

Clients should be deleted when they are no longer going to be used (ex: in test cleanup code)

DELETE /testproxy/api/profile/{profileIdentifier}/clients/{clientUUID}

Enable/Disable A Profile/Client

POST /testproxy/api/profile/{profileIdentifier}/clients/{clientUUID}
POST BODY: active=true|false

Enable/Disable an Override Path

POST /testproxy/api/path/{pathIdentifier}
POST BODY for Response Path: profileIdentifier={profileIdentifier}&responseEnabled=true|false
POST BODY for Request Path: profileIdentifier={profileIdentifier}&requestEnabled=true|false

Reset all settings for an Override Path

POST /testproxy/api/path/{pathIdentifier}
POST BODY for Response Path: profileIdentifier={profileIdentifier}&resetResponse=true
POST BODY for Request Path: profileIdentifier={profileIdentifier}&resetRequest=true

Get ID for a Method

In order to enable/disable a method on a path you need the override ID. The following request can be used to method information and find the ID {methodName} - Fully qualified method name. Ex: com.groupon.odo.override.Sleep

GET /testproxy/method/{methodName}
{
  "method": {
    "id": 55,
    "httpCode": 200,
    "description": "Sleeps",
    "methodName": "Sleep",
    "className": "com.groupon.odo.override",
    "methodType": "interface com.groupon.odo.plugin.ResponseOverride",
    "methodArguments": [
    ],
    "methodArgumentNames": [
    ]
  }
}

Enable method on an override path

POST /testproxy/api/path/{pathIdentifier}
POST BODY: profileIdentifier={profileIdentifier}&addOverride={methodID}
Special Method IDs

Custom Response = -1 Custom Request = -2 Add Response Header = -3 Remove Response Header = -4 Add Request Header = -5 Remove Request Header = -6

Remove method from an override path

POST /testproxy/api/path/{pathIdentifier}
POST BODY: profileIdentifier={profileIdentifier}&removeOverride={methodID}

Set method arguments

Note: This is not always needed.. depends on the method you are using

The "ordinal" parameter is optional and is intended to indicate which enabled override you want to modify if multiple instances of the same override were added (ex: multiple custom responses). The ordinal is based at 1.

POST /testproxy/api/path/{pathIdentifier}/{methodName}
POST BODY: profileIdentifier={profileIdentifier}&ordinal=1&arguments[]=argument1&arguments[]=argument2&arguments[]=argument3

Set custom response data

Custom response data is just the first argument to the custom response enabled override

POST /testproxy/api/path/{pathIdentifier}/-1
POST BODY: profileIdentifier={profileIdentifier}&ordinal=1&arguments[]=this%20is%20my%20custom%20response

Set custom request data

POST /testproxy/api/path/{pathIdentifier}
POST BODY for Response Path: profileIdentifier={profileIdentifier}&customResponse=<data>
POST BODY for Request Path: profileIdentifier={profileIdentifier}&customRequest=<data>

Set repeat count for an enabled override method

You can set the repeat count for a specific enabled method instead of the whole path. This is the same call as setting an argument except using the parameter repeatNumber

POST /testproxy/api/path/{pathIdentifier}/-1
POST BODY: profileIdentifier={profileIdentifier}&ordinal=1&repeatNumber=5
⚠️ **GitHub.com Fallback** ⚠️