Friday, July 27, 2018

WebApi - Enable to CORS - cross domain - get Json format

WebApiConfig.cs under App_Start

using System.Net.Http.Headers;
using System.Web.Http;
using System.Web.Http.Cors; 


// Web API configuration and services
            var cors = new EnableCorsAttribute("*", "*", "*");
            config.EnableCors(cors);


config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );

//This will get JSOn format
            config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));

No comments:

Update or edit status filed in JIRA issue

the status field is a special case and can't be updated directly, which is the second problem here. Changing a status in Jira is called ...