Arya raj

Arya raj

  • NA
  • 57
  • 35k

how to write http client api to endpints in web.config

Aug 5 2019 12:16 AM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace C3ANS_WebAPI.Controllers
{
public class AttributeController : ApiController
{
// saving attributes
[Route("api/DRS/v1/Attributes")]
[HttpPost]
public async Task<HttpResponseMessage> PostAttribute()
{
try
{
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Accept.Clear();
HttpResponseMessage response = await client.PostAsync("http://localhost:8089/api/DRS/v1/Attributes", Request.Content);
 
AttributeController.cs, Line 21, 1 comment

Answers (1)