Exemplo n.º 1
0
        public JsonResult <PostmanCollection> GetPostmanCollection_Raw(string serviceName = "WebAPI2PostMan")
        {
            var collectionId = PostMan.GetId();
            var apis         = Configuration.Services.GetApiExplorer().ApiDescriptions.Where(x => x.Documentation != null);
            var requests     = GetPostmanRequests_Raw(apis, collectionId);
            var collection   = new PostmanCollection
            {
                id          = collectionId,
                name        = serviceName,
                description = "",
                order       = requests.Select(x => x.id).ToList(),
                timestamp   = 0,
                requests    = requests
            };

            return(Json(collection));
        }
Exemplo n.º 2
0
 private List <PostmanRequest> GetPostmanRequests_Urlencoded(IEnumerable <ApiDescription> apis, string collectionId)
 {
     return(apis.Select(api => new PostmanRequest
     {
         collection = collectionId,
         id = PostMan.GetId(),
         name = api.Documentation,
         dataMode = "urlencoded",
         data = GetPostmanDatas_Urlencoded(api),
         description = "",
         descriptionFormat = "html",
         headers = "",
         method = api.HttpMethod.Method,
         pathVariables = new Dictionary <string, string>(),
         url = Request.RequestUri.Authority + "/" + api.RelativePath,
         version = 2,
         collectionId = collectionId
     }).ToList());
 }