Though SDKs in different languages are implemented differently, all their interfaces comply with the request-response principle, that is, call the API as follows:
  1. Build a request by using request parameters.
  2. Call the corresponding interface in the SDK and pass in the request in the preceding step.
  3. Encapsulate the results returned by the SDK interface into a response and then return the response to the user.

The following code snippets show how to obtain the names of all Logstores in a project based on the preceding process.

Java 

// Other code......
String accessId = "your_access_id"; //TODO: Use your Alibaba Cloud AccessKey ID.
String accessKey = "your_access_key"; //TODO: Use your Alibaba Cloud AccessKey Secret.
String project = "your_project"; //TODO: Use your project name.
String endpoint = "region_endpoint";//TODO: Use the endpoint that corresponds to the region where your project resides.
//Build a client.
Client client = new Client(endpoint, accessId, accessKey);
//Use the request parameter "project" to initialize the ListLogstores request class.
ListLogStoresRequest lsRequest = new ListLogStoresRequest(project);
//Use the request to call the ListLogstores interface. The return parameter is the corresponding response.
ListLogStoresResponse res = client.ListLogStores(lsRequest);
//Access the response to retrieve the request results.
ArrayList<String> names = res.GetLogStores();
// Other code...

. NET(C#)

// Other code...
String accessId = "your_access_id"; //TODO: Use your Alibaba Cloud AccessKey ID.
String accessKey = "your_access_key"; //TODO: Use your Alibaba Cloud AccessKey Secret.
String project = "your_project"; //TODO: Use your project name.
String endpoint = "region_endpoint";//TODO: Use the endpoint that corresponds to the region where your project resides.
//Construct a client instance.
SLSClient client = new SLSClient(endpoint, accessId, accessKey);
//Use the request parameter "project" to initialize a ListLogstores request class.
ListLogStoresRequest lsRequest = new ListLogStoresRequest();
lsRequest.Project = project;
//Use the request instance to call the ListLogstores interface. The return parameter is the corresponding response instance.
ListLogStoresResponse res = client.ListLogStores(lsRequest);
//Access the response instance to retrieve the request results
List<String> names = res.Logstores;
// Other code...

PHP

// Other code...
accessId = "your_access_id"; //TODO: Use your Alibaba Cloud AccessKey ID.
$accessKey = "your_access_key"; //TODO: Use your Alibaba Cloud AccessKey Secret.
$project = "your_project"; //TODO: Use your project name.
$endpoint = "region_endpoint";//TODO: Use the endpoint that corresponds to the region where your project resides.
//Construct a Log Service client instance.
$client = new Aliyun_Sls_Client($endpoint, $accessId, $accessKey);
//Use the request parameter "project" to initialize a ListLogstores request class.
$request = new Aliyun_Sls_Models_ListLogstoresRequest($project);
//Use the request instance to call the ListLogstores interface. The return parameter is the corresponding response instance.
$response = $client->listLogstores($request);
//Access the response instance to retrieve the request results
$names = $response->getLogstores();
// Other code......

Python

// Other code......
accessId = 'your_access_id'; //TODO: Use your Alibaba Cloud AccessKey ID.
$accessKey = "your_access_key"; //TODO: Use your Alibaba Cloud AccessKey Secret.
project = 'your_project'; //TODO: Use your project name.
endpoint = 'region_endpoint';//TODO: Use the endpoint that corresponds to the region where your project resides.
# Build a client.
client = LogClient(endpoint, accessId, accessKey)
# Use the request parameter "project" to initialize the ListLogstores request class.
lsRequest = ListLogstoresRequest(project)
# Use the request to call the ListLogstores interface. The return parameter is the corresponding response.
res = client.list_logstores(lsRequest)
# Access the response to retrieve the request results.
names = res.get_logstores();
// Other code......

SDKs implement multiple sets of interfaces similar to ListLogstores and define the corresponding request and response classes. In addition to the basic request-response interfaces, SDKs in different languages provide secondary interfaces encapsulated with these basic interfaces, removing the need to build requests and parse the final response on your own.  For more information about the secondary interfaces, see the API reference of each SDK.