• This topic has 0 replies, 1 voice, and was last updated October 8, 2018 by Darren S.

REST API Changes 5.0 update 3

  • If any customers have been running our Zerto scripts which we provide as examples (whitepapers) on versions 5.0 update 2 and below then please have a read of the below:

    As per our release notes in 5.0 update 3 there was a change in the API which gives Zerto better security. I have seen numerous requests from people stating that their scripts no longer work. Fortunately the fix is very simple and it is all down to the “accept headers” and the content type with the scripts.

    Some Basic facts:

    • Our API supports two formats(Content-types) in the response – XML, JSON,
    • The response format can be controlled in the request headers by using “Accept” header with desired content type.
    • When a user does not supply an ‘Accept’ header in the request he leaves the decision to the server on which format to use in the response Body,
    • When user does not supply an ‘Accept’ header it is in his responsibility to check the response format.
    • Since 5.0 u3, the response format in case no ‘Accept’ header was given in the request is JSON(application/json).
    • Before – it was set by request content type
    • The change is due to a security feature we added to the REST API.

    the cause for the script failure:

    When XML content type is returned there is another level of naming, the top level, for example retrieving a VPG list of all the VPGs in a site will yield the attached responses. (see XML.PNG)

    As you can see in the JSON (see JSON.PNG) format there in no name for the top level object (ArrayOfVpgApi) where the XML response there is, now in pre-5.0U3 versions, requests with content type “application/xml” or “text/xml” would yield a xml response, while in 5.0U3 the request Content type is ignored and only request “Accept” header will determine the response format.

    So in future of existing scripts please ensure your accept header is set to the correct content.

    Thanks,

    Darren Swift 
    Principal System Engineer 
    darren@zerto.com

     

     

You must be logged in to create new topics. Click here to login