Gets the default template by identifier. (根据ID获得默认模板)

REST API: http://yunpian.com/v1/tpl/get_default.json
Code sample: [Please change api key with your own in your codes] (示例代码: [请在你自己的代码里修改你自己的api key的值)]
class Program
{
    /// <summary>
    /// Defines the entry point of the application.
    /// </summary>
    /// <param name="args">The arguments.</param>
    /// <exception cref="System.InvalidOperationException">Failed to send SMS by template</exception>
    static void Main(string[] args)
    {
        // Need to replace with your own API key here.
        // 此处的值需要被替换成你自己的API Key
        const string yourApiKey = "YourApiKey";

        // Create instance of API client.
        // 创建 API Client 实例
        ApiClient client = new ApiClient(yourApiKey);

        // Use default template (id= 1) here.
        // 使用ID为1的默认模板
        string templateId = "1";

        // Get template content
        // 获得模板内容
        var response = client.GetDefaultTemplateById(templateId);

        // Check if any error occurred.
        // 检查是否有错误
        if (response == null || response.Code != 0)
        {
            throw new InvalidOperationException("Failed to GetDefaultTemplateById");
        }

        // Print response data for template info
        // 打印返回的模板信息
        Console.WriteLine("Id: {0}, Content: {1}", response.Data.Id, response.Data.Content);
    }
}

Last edited Sep 26, 2014 at 4:03 AM by rynnwang, version 1