我对Smartsheet很新,使用c#进行编程。主要是初学者,并尝试使用visual studio 2013将我的Web应用程序与Smartsheet集成。我目前正在努力获得一个gridview控件来填充来自Smartsheet的返回数据(以json格式)。到目前为止,我已经能够获得包含以下内容的json字符串:
{
"id":4705121406871428,
"name":"Distributors",
"version":3,
"totalRowCount":2,
"accessLevel":"OWNER",
"effectiveAttachmentOptions":[
"DROPBOX",
"GOOGLE_DRIVE",
"BOX_COM",
"FILE"
],
"ganttEnabled":false,
"dependenciesEnabled":false,
"permalink":"https://app.smartsheet.com/b/home?lx=xlJ7OtqknyOndgOnClj4qg",
"createdAt":"2015-06-22T16:55:02+10:00",
"modifiedAt":"2015-06-23T14:17:47+10:00",
"columns":[
{
"id":3238895438587780,
"index":0,
"title":"id",
"type":"TEXT_NUMBER",
"primary":true,
"width":150
},
{
"id":7742495065958276,
"index":1,
"title":"distName",
"type":"TEXT_NUMBER",
"width":150
},
{
"id":2112995531745156,
"index":2,
"title":"agency",
"type":"TEXT_NUMBER",
"width":150
},
{
"id":6616595159115652,
"index":3,
"title":"profile",
"type":"TEXT_NUMBER",
"width":150
}
],
"rows":[
{
"id":3999757174630276,
"rowNumber":1,
"expanded":true,
"createdAt":"2015-06-23T11:05:26+10:00",
"modifiedAt":"2015-06-23T14:17:47+10:00",
"cells":[
{
"columnId":3238895438587780,
"type":"TEXT_NUMBER",
"value":1.0,
"displayValue":"1"
},
{
"columnId":7742495065958276,
"type":"TEXT_NUMBER",
"value":"ABS",
"displayValue":"ABS"
},
{
"columnId":2112995531745156,
"type":"TEXT_NUMBER",
"value":"ShedsRus",
"displayValue":"ShedsRus"
},
{
"columnId":6616595159115652,
"type":"TEXT_NUMBER",
"value":"OK",
"displayValue":"OK"
}
]
},
{
"id":8503356802000772,
"rowNumber":2,
"siblingId":3999757174630276,
"expanded":true,
"createdAt":"2015-06-23T11:05:26+10:00",
"modifiedAt":"2015-06-23T14:17:47+10:00",
"cells":[
{
"columnId":3238895438587780,
"type":"TEXT_NUMBER",
"value":2.0,
"displayValue":"2"
},
{
"columnId":7742495065958276,
"type":"TEXT_NUMBER",
"value":"Barns",
"displayValue":"Barns"
},
{
"columnId":2112995531745156,
"type":"TEXT_NUMBER",
"value":"BarnsRus",
"displayValue":"BarnsRus"
},
{
"columnId":6616595159115652,
"type":"TEXT_NUMBER",
"value":"OK",
"displayValue":"OK"
}
]
}
]
}
此字符串看起来包含太多信息,例如id&s;和类型等... 我想要的只是我的列名及其相关数据。 然后,将此信息显示为gridview控件。
这是我的json请求:
string sURL;
sURL = "https://api.smartsheet.com/1.1/sheet/4705121406871428";
WebRequest wrGETURL;
wrGETURL = WebRequest.Create(sURL);
wrGETURL.ContentType = "application/json";
wrGETURL.Method = "GET";
wrGETURL.Headers["Authorization"] = "Bearer ******************";
Stream objStream;
objStream = wrGETURL.GetResponse().GetResponseStream();
StreamReader objReader = new StreamReader(objStream);
string jsonResult = objReader.ReadToEnd();
如果有人可以提供一些指导来让我为我工作,我将不胜感激...请原谅我对这个主题的完全无知...在这里完成newb!感谢。