2012-06-07 86 views
0

我打算寫一個簡單的SugarCrm .Net客戶端。SugarCrm REST .Net wrapper

任何人都可以給我一個指向SugarCrm REST API的.Net包裝器/庫的指針嗎?

//拉塞

+0

選中此鏈接(http://developers.sugarcrm.com/wordpress/2011/11/14/web-services-in-your-own-language-part-7-building-a-client-net-for -sugarcrm /) – Damith

+0

嘿,你有沒有做到這一點?如果是這樣,你能幫助一個兄弟出去嗎? –

回答

3

意識到這是舊的,但如果任何人碰到這個絆倒在尋找一個.NET包裝爲Web服務(SugarCRM公司> 6.7)的新版本,這裏是一個包裝我目前正在建設https://github.com/dlively1/SugarSharp

+0

不錯的圖書館丹,解僱了它,它首先在這裏工作。 – jvenema

-2

我也意識到這是舊的,但對於SugarCRM CE 6.x我創建了SugarRestSharp。我在下面給出的示例是json,但是請求將使用C#模型。這實現了get_entry_list SugarCrm Rest API方法。

傳遞請求RestSharp:

 

    dynamic data = new 
    { 
     session = sessionId, 
     module_name = moduleName, 
     query = queryString, 
     order_by = string.Empty, 
     offset = 0, 
     select_fields = selectFields, 
     link_name_to_fields_array = string.Empty, 
     max_results = maxCountResult, 
     deleted = 0, 
     favorites = false 
    }; 

    var client = new RestClient(url); 

    var request = new RestRequest(string.Empty, Method.POST); 
    string jsonData = JsonConvert.SerializeObject(data); 

    request.AddParameter("method", "get_entry_list"); 
    request.AddParameter("input_type", "json"); 
    request.AddParameter("response_type", "json"); 
    request.AddParameter("rest_data", jsonData); 

    var response = client.Execute(request); 

請求以JSON

 

    { 
     "session": "olgg6hf5sqi6hk9u3tgpafbn66", 
     "module_name": "Accounts", 
     "query": "", 
     "order_by": "", 
     "offset": 0, 
     "select_fields": [ 
     "name", 
     "industry", 
     "website", 
     "shipping_address_city", 
     "id" 
     ], 
     "link_name_to_fields_array": "", 
     "max_results": 10, 
     "deleted": 0, 
     "favorites": false 
    } 

響應以JSON

 

    { 
     "result_count": 10, 
     "total_count": "58", 
     "next_offset": 10, 
     "entry_list": [ 
     { 
      "id": "1e0eec64-8cc6-58ff-57f1-58533731b145", 
      "module_name": "Accounts", 
      "name_value_list": { 
      "name": { 
       "name": "name", 
       "value": "New SugarRestSharp Acccount 1 10397" 
      }, 
      "industry": { 
       "name": "industry", 
       "value": "Manufacturing" 
      }, 
      "website": { 
       "name": "website", 
       "value": "www.sugarrestsharp1.com" 
      }, 
      "shipping_address_city": { 
       "name": "shipping_address_city", 
       "value": "Los Angeles" 
      }, 
      "id": { 
       "name": "id", 
       "value": "1e0eec64-8cc6-58ff-57f1-58533731b145" 
      } 
      } 
     }, 
     ......... (other 9 items truncated) 
     ], 
     "relationship_list": [ 

     ] 
    } 

更多的實施和wiki檢查SugarRestSharp:https://github.com/mattkol/SugarRestSharp