• C# Get请求携带body


    C# get 请求携带body需要用到RestSharp,可以通过NuGet获取,但是只有.NetFramework 4.5+版本支持。通过Postman可以测试并生成C#代码

     

    var client = new RestClient("https://orapi-stg.trackmeeasy.com/lomp-ext/sf-express/waybillService/getAgentNo?=");
    var request = new RestRequest(Method.GET);
    request.AddHeader("cache-control", "no-cache");
    request.AddHeader("Connection", "keep-alive");
    request.AddHeader("content-length", "202");
    request.AddHeader("accept-encoding", "gzip, deflate");
    request.AddHeader("Host", "orapi-stg.trackmeeasy.com");
    request.AddHeader("Postman-Token", "56ca6784-0c31-4d41-b5d2-6bdcc047789a,d9873963-5dee-48f1-80d9-d672dede40f4");
    request.AddHeader("Cache-Control", "no-cache");
    request.AddHeader("Accept", "*/*");
    request.AddHeader("User-Agent", "PostmanRuntime/7.11.0");
    request.AddHeader("Content-Type", "application/json");
    request.AddParameter("undefined", "{
    	"service": "WaybillService",
    	"api_username": "erptest",
    	"api_key": "78BE1BCAAED1EE08D344F894FBB296D3",
    	"waybill": [{
    		"orderid": "460692315855",
    		"waybillno": "ML18082997131401_15"
    	}]
    }", ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);

    参考https://blog.csdn.net/qq_26878363/article/details/86506369

  • 相关阅读:
    树链剖分学习笔记(未完)
    VI 配置文件(略全)
    linux之awk
    指针之基础篇
    linux之sed
    sqlplus命令手册
    Leetcode复习: 堆和栈
    leetcode 的shell部分4道题整理
    Regular Expression Matching [leetcode]
    深入浅出JAVA
  • 原文地址:https://www.cnblogs.com/lidaying5/p/10797642.html
Copyright © 2020-2023  润新知