RESTful response types

When you make a RESTful request, you can specify the response type.  

Setting response types using HTTP:

  • When you use a browser, the response type is always XML.
  • When you submit RESTful requests by building your own HTTPRequests from your own client, you can use the Acceptfield to set the response type to any of the following:

    If you want this format:

    Set Accept field to:

    XML

    text/xml This is the default.

    JSON

    application/json

The following example sets response type to XML:

URL url = new URL("https://localhost:9843/type/PropertySetClasses/
SystemObject/Server?username=testuser&password=password&role=myrole");
        // Parse the response...
HttpsURLConnection urlConnection = (HttpsURLConnection)url.openConnection();
HttpsURLConnection urlConnection = (HttpsURLConnection)url.openConnection();
urlConnection.setRequestProperty("Accept", "text/xml");
urlConnection.setRequestProperty("Accept", "text/xml");

Setting response types through the BLCLI

Use the -rr option to set the response type to one of the following values:

  • XML - This is the default.
  • JSON - Java Script Object Notation
    Example:
    blcli -rr JSON
Was this page helpful? Yes No Submitting... Thank you

Comments