I want to add a parameter, but I also have a body, I want to form this format:
HttpPost
http://localhost:8080/master/public/api/v1/invoice/send?token=123456
Currently I have:
HttpPost
http://localhost:8080/master/public/api/v1/invoice/send
 private readonly string UrlBase = "http://localhost:8080";
 private readonly string ServicePrefix = "master/public/api";
public async Task<DocumentResponse> SendInvoice<T>(Invoice body)
            {
            string controller = "/v1/invoice/send";
            try
            {
                var request = JsonConvert.SerializeObject(body);
                var content = new StringContent(
                    request, Encoding.UTF8,
                    "application/json");
                var client = new HttpClient();
                client.BaseAddress = new Uri(UrlBase);
                var url = string.Format("{0}{1}", ServicePrefix, controller);
                var response = await client.PostAsync(url, content);
                Debug.WriteLine(response);
                var result = await response.Content.ReadAsStringAsync();
                if (!response.IsSuccessStatusCode)
                {
                    return new DocumentResponse
                    {
                    };
                }
                var list = JsonConvert.DeserializeObject<DocumentResponse>(result);
                return list;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                return new DocumentResponse
                {
                };
            }
        }
When I add it directly to the url, the request fails.
Advance
When I add it directly to the url, the request fails. Inquiring about HttpClient, I found this, but how do I add it having a body?
var parameters = new Dictionary<string, string> { { "token", "123456" } };
var encodedContent = new FormUrlEncodedContent (parameters);
Ref: C#: HttpClient with POST parameters
Thank you
 
    