using System;
using System.Collections.Generic;
using com.taobao.api.util;
using com.taobao.api;
using System.Net;
using System.IO;
using System.Text;
using System.Web;
namespace Taobao.open.api {
/// <summary>
/// taobao.items.get C#客户端API调用示例.
/// </summary>
public class ItemsGet
{
public ItemsGet() {
Dictionary<string, string> req_params =
new Dictionary<string, string>();
//系统级输入参数 //app_key
req_params.Add("app_key","test");
//返回格式
req_params.Add("format","xml");
//api方法名
req_params.Add("method","taobao.items.get");
//时间戳
req_params.Add("timestamp",DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));
//版本
req_params.Add("v","1.0");
//应用级输入参数
//返回字段列表
req_params.Add("fields","iid,title,nick,pic_path,cid,price,type,location.city,delist_time,post_fee");
//查询条件
req_params.Add("q","iphone 3g");
//Secret,App Secret密钥
string secret="test";
//sign,生成签名字符串
string sign=EncryptUtil.Signature(req_params,secret,"sign");
req_params.Add("sign",sign);
//调用API
TaobaoJsonRestClient client=new TaobaoJsonRestClient();
string responseBody=client.invokeAPI(req_params); Console.WriteLine(responseBody); }
public static void Main(string[] args) {
//调用API
ItemsGet itemsGet=new ItemsGet(); } } }