TargetServers API

Apigee Edge enhances the availability of your API by providing built-in support for load balancing and failover across multiple backend server instances. TargetServer configurations decouple concrete endpoint URLs from TargetEndpoint configurations.

Resource Types

URIs are relative to https://api.enterprise.apigee.com/v1, unless otherwise noted.

TargetServer

For more information, see TargetServer.
MethodEndpointDescription
post/organizations/{org_name}/environments/{env_name}/targetservers

Creates a TargetServer in the specified environment.

TargetServers are used to decouple TargetEndpoint HTTPTargetConnections from concrete URLs for backend services. An HTTPConnection can be configured to use a LoadBalancer that lists one or more TargetSevers. Using TargetServers, you can create an HTTPTargetConnection that calls a different backend server based on the environment where the API proxy is deployed. See also Load balancing across backend servers.

For example, instead of the following configuration:

<TargetEndpoint name="default"> 
  <HTTPTargetConnection> 
    <URL>http://s1.mybackendservice.com</URL>
  </HTTPTargetConnection>
</TargetEndpoint> 

You can reference a TargetServer as follows:

<TargetEndpoint name="default"> 
  <HTTPTargetConnection> 
    <LoadBalancer>
     <Server name="target1"/>
    </LoadBalancer>
  </HTTPTargetConnection>
</TargetEndpoint>

You can then set up a TargetServer called target1 in the test environment that points to a test backend service, and a different TargetServer called target1 in the prod environment that points to a production backend.

When you promote the API proxy with this configuration from the test to the prod environment, the TargetEndpoint will use the appropriate backend service, without requiring any changes in the API proxy configuration.

delete/organizations/{org_name}/environments/{env_name}/targetservers/{targetserver_name}

Deletes a TargetServer configuration from an environment.

Note: The deletion of a TargetServer can fail if it is referenced by a currently deployed API proxy. Before deleting a TargetServer, check to make sure that it's not referenced by any API proxies that are currently deployed.

get/organizations/{org_name}/environments/{env_name}/targetservers/{targetserver_name}

Gets TargetServer details.

put/organizations/{org_name}/environments/{env_name}/targetservers/{targetserver_name}

Modifies an existing TargetServer. (You can also modify TargetServers in the Edge UI, as described in Load balancing across backend servers.)

For example, use this method to toggles a TargetServer configuration from enabled to disabled. This is useful when TargetServers are used in load balancing configurations, and one or more TargetServers need to taken out of rotation periodically. You could also use this API to modify the hostname of an enabled TargetServer.

Note: When Content-Type is set to application/json, make sure that you specify sSLInfo in the request body, not SSLInfo (note the case); otherwise, an error is returned. The case does not matter if Content-Type is application/xml.