SDK is automatically generated for your application and includes functions like composing request, generating encryption, response interpretation, message monitoring, and other functions. Using SDK to invoke the APIs is simple and straightforward, and it is recommended to call API with official SDK.
Before you can download SDK, you need to have registered as a developer and able to login to Miravia Open Platform. The downloaded SDK is associated with the application.
Take the following steps to download SDK for your application:
1. Login Miravia Open Platform and open the APP Console page.
2. Click Manage in the App list to open the App Overview page.
3. In the App Management navigation panel, click SDK Download.
4. Click the Download button to download the SDK for the specific programming language.
Take the “/order/get” API as example:
JAVA sample code:
IopClient client = new IopClient(url, appkey, appSecret); IopRequest request = new IopRequest(); request.setApiName("/order/get"); request.setHttpMethod("GET"); request.addApiParameter("order_id", "16090"); IopResponse response = client.execute(request, accessToken); System.out.println(response.getBody()); Thread.sleep(10);
.NET sample code
IIopClient client = new IopClient(url, appkey, appSecret); IopRequest request = new IopRequest(); request.SetApiName("/order/get"); request.SetHttpMethod("GET"); request.AddApiParameter("order_id", "16090"); IopResponse response = client.Execute(request, accessToken); Console.WriteLine(response.IsError()); Console.WriteLine(response.Body);
PHP sample code
$c = new IopClient(url,appkey,appSecret); $request = new IopRequest('/order/get','GET'); $request->addApiParam('order_id','16090'); var_dump($c->execute($request, $accessToken));
Ruby sample code
client = IopApiClient::Client.new(url, appkey, appSecret) request = IopApiClient::Request.new('/order/get','GET') request.add_api_parameter("order_id", "16090") response = client.execute(request, accessToken) puts response.success? puts response.body
Python sample code
client = iop.IopClient(url, appkey ,appSecret) request = iop.IopRequest('/order/get','GET') request.add_api_param('order_id', '16090') response = client.execute(request, access_token) print(response.type) print(response.body)
Note: Most API methods are called via GET, but some API methods have additional request data sent via POST. Therefore, you need to update your code accordingly. The request type of each API is indicated in the API reference documentation.