@alicloud/pop-core
The core SDK of POP API.
Installation
Install it and write into package.json dependences.
$ npm install @alicloud/pop-core -S
Prerequisite
Node.js >= 6.x
Notes
You must know your AK
(accessKeyId/accessKeySecret
), and the cloud product's endpoint
and apiVersion
.
For example, The ECS OpenAPI(https://help.aliyun.com/document_detail/25490.html), the API version is 2014-05-26
.
And the endpoint list can be found at here, the center endpoint is ecs.aliyuncs.com. Add http protocol http
or https
, should be http://ecs.aliyuncs.com/
.
Usage
The RPC style client:
var RPCClient = require('@alicloud/pop-core').RPCClient;
var client = new RPCClient({
accessKeyId: '<accessKeyId>',
accessKeySecret: '<accessKeySecret>',
endpoint: '<endpoint>',
apiVersion: '<apiVersion>'
});
client.request(action, params);
client.request(action, params, {
timeout: 3000,
formatAction: true,
formatParams: true,
method: 'GET',
headers: {},
});
The ROA style client:
var ROAClient = require('@alicloud/pop-core').ROAClient;
var client = new ROAClient({
accessKeyId: '<accessKeyId>',
accessKeySecret: '<secretAccessKey>',
endpoint: '<endpoint>',
apiVersion: '<apiVersion>'
});
client.request('GET', '/regions');
License
The MIT License