MCServe API :: The Basic Compatibility Test

How to check the compatibility of the API server and the client API

Description :
This function checks the version of the client API with the server. If the API is compatible, true is returned, otherwise false is returned.

Example (.NET C#) :
MCServeApi MCServeApi = new MCServeApi();
String Command = ApiCommands.BASICCHECK;
ApiValues Values = new ApiValues();
Values.Add("Version", new Version(ApiMeta.ApiVersion.Major, ApiMeta.ApiVersion.Minor, ApiMeta.ApiVersion.Build));
ApiResult Response = null;

Response = MCServeApi.Query(Command, Values);
JsonStandardResult JsonResult = JsonConvert.DeserializeObject<JsonStandardResult>(Response.Message);

Example (.NET Visual Basic) :
Dim MCServeApi As New MCServeApi()
Dim Command As [String] = ApiCommands.BASICCHECK
Dim Values As New ApiValues()
Values.Add("Version", New Version(ApiMeta.ApiVersion.Major, ApiMeta.ApiVersion.Minor, ApiMeta.ApiVersion.Build))
Dim Response As ApiResult = Nothing

Response = MCServeApi.Query(Command, Values)
Dim JsonResult As JsonStandardResult = JsonConvert.DeserializeObject(Of JsonStandardResult)(Response.Message)

Response :
    "Result": true,
    "Message": "The client uses the correct API version.",
    "Code": 4

    "Result": false,
    "Message": "The client uses the wrong API version.",
    "Code": 3

Last edited Mar 9, 2013 at 9:52 AM by Xe77a, version 10


No comments yet.