Outlining a Client for the JSON Protocol

A client to work with the JSON protocol generally contains the following parts, at minimum.

  • The basic elements of the URL, including the address of the vCenter Server instance, the service endpoint specifier, and the version specifier.
  • The credentials with which you authenticate your client session.
  • Code to GET managed object properties, such as the ServiceInstance content, which contains managed object references to singletons, including the SessionManager.
  • Code to POST requests to invoke methods on managed objects, such as the Login method.
  • A request to fetch the ServiceInstance content and extract the SessionManager managed object reference.
  • A request to authenticate the client session with the SessionManager.
  • A request to end the client session.

The following sections use fragments of Python code to show how you can build these parts of the request.