Chilkat Online Tools

unicodeC / Postman API / Import external API specification

Back to Collection Items

#include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkHttpResponseW.h>
#include <C_CkStringBuilderW.h>

void ChilkatSample(void)
    {
    HCkHttpW http;
    BOOL success;
    HCkJsonObjectW json;
    HCkHttpResponseW resp;
    HCkStringBuilderW sbResponseBody;
    HCkJsonObjectW jResp;
    int respStatusCode;
    const wchar_t *id;
    const wchar_t *name;
    const wchar_t *uid;
    int i;
    int count_i;

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    http = CkHttpW_Create();

    // Use this online tool to generate code from sample JSON: Generate Code to Create JSON

    // The following JSON is sent in the request body.

    // {
    //   "type": "json",
    //   "input": {
    //     "openapi": "3.0.0",
    //     "info": {
    //       "version": "1.0.0",
    //       "title": "Swagger Petstore",
    //       "license": {
    //         "name": "MIT"
    //       }
    //     },
    //     "servers": [
    //       {
    //         "url": "http://petstore.swagger.io/v1"
    //       }
    //     ],
    //     "paths": {
    //       "/pets": {
    //         "get": {
    //           "summary": "List all pets",
    //           "operationId": "listPets",
    //           "parameters": [
    //             {
    //               "name": "limit",
    //               "in": "query",
    //               "description": "limit",
    //               "required": false,
    //               "schema": {
    //                 "type": "integer",
    //                 "format": "int32"
    //               }
    //             }
    //           ],
    //           "responses": {
    //             "default": {
    //               "description": "unexpected error",
    //               "content": {
    //                 "application/json": {
    //                   "schema": {
    //                     "required": [
    //                       "code",
    //                       "message"
    //                     ],
    //                     "properties": {
    //                       "code": {
    //                         "type": "integer",
    //                         "format": "int32"
    //                       },
    //                       "message": {
    //                         "type": "string"
    //                       }
    //                     }
    //                   }
    //                 }
    //               }
    //             }
    //           }
    //         }
    //       }
    //     }
    //   }
    // }

    json = CkJsonObjectW_Create();
    CkJsonObjectW_UpdateString(json,L"type",L"json");
    CkJsonObjectW_UpdateString(json,L"input.openapi",L"3.0.0");
    CkJsonObjectW_UpdateString(json,L"input.info.version",L"1.0.0");
    CkJsonObjectW_UpdateString(json,L"input.info.title",L"Swagger Petstore");
    CkJsonObjectW_UpdateString(json,L"input.info.license.name",L"MIT");
    CkJsonObjectW_UpdateString(json,L"input.servers[0].url",L"http://petstore.swagger.io/v1");
    CkJsonObjectW_UpdateString(json,L"input.paths./pets.get.summary",L"List all pets");
    CkJsonObjectW_UpdateString(json,L"input.paths./pets.get.operationId",L"listPets");
    CkJsonObjectW_UpdateString(json,L"input.paths./pets.get.parameters[0].name",L"limit");
    CkJsonObjectW_UpdateString(json,L"input.paths./pets.get.parameters[0].in",L"query");
    CkJsonObjectW_UpdateString(json,L"input.paths./pets.get.parameters[0].description",L"limit");
    CkJsonObjectW_UpdateBool(json,L"input.paths./pets.get.parameters[0].required",FALSE);
    CkJsonObjectW_UpdateString(json,L"input.paths./pets.get.parameters[0].schema.type",L"integer");
    CkJsonObjectW_UpdateString(json,L"input.paths./pets.get.parameters[0].schema.format",L"int32");
    CkJsonObjectW_UpdateString(json,L"input.paths./pets.get.responses.default.description",L"unexpected error");
    CkJsonObjectW_UpdateString(json,L"input.paths./pets.get.responses.default.content.application/json.schema.required[0]",L"code");
    CkJsonObjectW_UpdateString(json,L"input.paths./pets.get.responses.default.content.application/json.schema.required[1]",L"message");
    CkJsonObjectW_UpdateString(json,L"input.paths./pets.get.responses.default.content.application/json.schema.properties.code.type",L"integer");
    CkJsonObjectW_UpdateString(json,L"input.paths./pets.get.responses.default.content.application/json.schema.properties.code.format",L"int32");
    CkJsonObjectW_UpdateString(json,L"input.paths./pets.get.responses.default.content.application/json.schema.properties.message.type",L"string");

    CkHttpW_SetRequestHeader(http,L"Content-Type",L"application/json");
    CkHttpW_SetRequestHeader(http,L"X-API-Key",L"{{postman_api_key}}");

    resp = CkHttpW_PostJson3(http,L"https://api.getpostman.com/import/openapi",L"application/json",json);
    if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(json);
        return;
    }

    sbResponseBody = CkStringBuilderW_Create();
    CkHttpResponseW_GetBodySb(resp,sbResponseBody);

    jResp = CkJsonObjectW_Create();
    CkJsonObjectW_LoadSb(jResp,sbResponseBody);
    CkJsonObjectW_putEmitCompact(jResp,FALSE);

    wprintf(L"Response Body:\n");
    wprintf(L"%s\n",CkJsonObjectW_emit(jResp));

    respStatusCode = CkHttpResponseW_getStatusCode(resp);
    wprintf(L"Response Status Code = %d\n",respStatusCode);
    if (respStatusCode >= 400) {
        wprintf(L"Response Header:\n");
        wprintf(L"%s\n",CkHttpResponseW_header(resp));
        wprintf(L"Failed.\n");
        CkHttpResponseW_Dispose(resp);
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(json);
        CkStringBuilderW_Dispose(sbResponseBody);
        CkJsonObjectW_Dispose(jResp);
        return;
    }

    CkHttpResponseW_Dispose(resp);

    // Sample JSON response:
    // (Sample code for parsing the JSON response is shown below)

    // {
    //   "collections": [
    //     {
    //       "id": "e956ff02-7597-4f8d-a5e7-1c18208c9e56",
    //       "name": "Swagger Petstore",
    //       "uid": "2282-e956ff02-7597-4f8d-a5e7-1c18208c9e56"
    //     }
    //   ]
    // }

    // Sample code for parsing the JSON response...
    // Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

    // Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.

    i = 0;
    count_i = CkJsonObjectW_SizeOfArray(jResp,L"collections");
    while (i < count_i) {
        CkJsonObjectW_putI(jResp,i);
        id = CkJsonObjectW_stringOf(jResp,L"collections[i].id");
        name = CkJsonObjectW_stringOf(jResp,L"collections[i].name");
        uid = CkJsonObjectW_stringOf(jResp,L"collections[i].uid");
        i = i + 1;
    }



    CkHttpW_Dispose(http);
    CkJsonObjectW_Dispose(json);
    CkStringBuilderW_Dispose(sbResponseBody);
    CkJsonObjectW_Dispose(jResp);

    }

Curl Command

curl -X POST
	-H "X-API-Key: {{postman_api_key}}"
	-H "Content-Type: application/json"
	-d '{
  "type" : "json",
  "input": {
    "openapi": "3.0.0",
    "info": {
  	  "version": "1.0.0",
  	  "title": "Swagger Petstore",
  	  "license": {
  	    "name": "MIT"
  	  }
    },
    "servers": [
      {
        "url": "http://petstore.swagger.io/v1"
      }
    ],
    "paths": {
  	  "/pets": {
        "get": {
          "summary": "List all pets",
          "operationId": "listPets",
          "parameters": [
            {
              "name": "limit",
              "in": "query",
              "description": "limit",
              "required": false,
              "schema": {
                "type": "integer",
                "format": "int32"
              }
            }
          ],
          "responses": {
            "default": {
              "description": "unexpected error",
              "content": {
                "application/json": {
                  "schema": {
                    "required": [
                        "code",
                        "message"
                    ],
                    "properties": {
                        "code": {
                        "type": "integer",
                        "format": "int32"
                        },
                        "message": {
                        "type": "string"
                        }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}'
https://api.getpostman.com/import/openapi

Postman Collection Item JSON

{
  "name": "Import external API specification",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"type\" : \"json\",\n  \"input\": {\n    \"openapi\": \"3.0.0\",\n    \"info\": {\n  \t  \"version\": \"1.0.0\",\n  \t  \"title\": \"Swagger Petstore\",\n  \t  \"license\": {\n  \t    \"name\": \"MIT\"\n  \t  }\n    },\n    \"servers\": [\n      {\n        \"url\": \"http://petstore.swagger.io/v1\"\n      }\n    ],\n    \"paths\": {\n  \t  \"/pets\": {\n        \"get\": {\n          \"summary\": \"List all pets\",\n          \"operationId\": \"listPets\",\n          \"parameters\": [\n            {\n              \"name\": \"limit\",\n              \"in\": \"query\",\n              \"description\": \"limit\",\n              \"required\": false,\n              \"schema\": {\n                \"type\": \"integer\",\n                \"format\": \"int32\"\n              }\n            }\n          ],\n          \"responses\": {\n            \"default\": {\n              \"description\": \"unexpected error\",\n              \"content\": {\n                \"application/json\": {\n                  \"schema\": {\n                    \"required\": [\n                        \"code\",\n                        \"message\"\n                    ],\n                    \"properties\": {\n                        \"code\": {\n                        \"type\": \"integer\",\n                        \"format\": \"int32\"\n                        },\n                        \"message\": {\n                        \"type\": \"string\"\n                        }\n                    }\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}"
    },
    "url": {
      "raw": "https://api.getpostman.com/import/openapi",
      "protocol": "https",
      "host": [
        "api",
        "getpostman",
        "com"
      ],
      "path": [
        "import",
        "openapi"
      ]
    },
    "description": "This endpoint allows you to import external API specifications into Postman.\n\nCurrently, this endpoint only supports the <a href=\"https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md\">OpenAPI</a> specification, for which the `importType` will be `openapi`.\n\nOn a successful import, the response will be an array with each element contaning `id`, `name` and `uid` of entities created.\n\nSupported `type`s:\n\n- string\n- json\n- file\n\nThe `input` parameter should be defined based on the `type`.\n\n> To import a file, request body must be form-data with `type` param set to `file`.\n\n**Note**: Refer to examples for different scenarios.\n\n> Requires <a href=\"#authentication\">API Key</a> as `X-Api-Key` request header."
  },
  "response": [
    {
      "name": "Success: Import to a specific workspace with workspace ID passed in the header",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "key": "X-Workspace-Id",
            "value": "c90a3482-f80d-43d6-9dfb-0830f5e43605"
          },
          {
            "name": "Content-Type",
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"type\" : \"json\",\n  \"input\": {\n    \"openapi\": \"3.0.0\",\n    \"info\": {\n  \t  \"version\": \"1.0.0\",\n  \t  \"title\": \"Swagger Petstore\",\n  \t  \"license\": {\n  \t    \"name\": \"MIT\"\n  \t  }\n    },\n    \"servers\": [\n      {\n        \"url\": \"http://petstore.swagger.io/v1\"\n      }\n    ],\n    \"paths\": {\n  \t  \"/pets\": {\n        \"get\": {\n          \"summary\": \"List all pets\",\n          \"operationId\": \"listPets\",\n          \"parameters\": [\n            {\n              \"name\": \"limit\",\n              \"in\": \"query\",\n              \"description\": \"limit\",\n              \"required\": false,\n              \"schema\": {\n                \"type\": \"integer\",\n                \"format\": \"int32\"\n              }\n            }\n          ],\n          \"responses\": {\n            \"default\": {\n              \"description\": \"unexpected error\",\n              \"content\": {\n                \"application/json\": {\n                  \"schema\": {\n                    \"$ref\": \"#/components/schemas/Error\"\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    },\n    \"components\": {\n      \"schemas\": {\n        \"Error\": {\n          \"required\": [\n            \"code\",\n            \"message\"\n          ],\n          \"properties\": {\n            \"code\": {\n              \"type\": \"integer\",\n              \"format\": \"int32\"\n            },\n            \"message\": {\n              \"type\": \"string\"\n            }\n          }\n        }\n      }\n    }\n  }\n}"
        },
        "url": {
          "raw": "https://api.getpostman.com/import/openapi",
          "protocol": "https",
          "host": [
            "api",
            "getpostman",
            "com"
          ],
          "path": [
            "import",
            "openapi"
          ],
          "variable": [
            {
              "key": "import_type",
              "value": "openapi"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json",
          "description": {
            "content": "",
            "type": "text/plain"
          }
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"collections\": [\n        {\n            \"id\": \"e956ff02-7597-4f8d-a5e7-1c18208c9e56\",\n            \"name\": \"Swagger Petstore\",\n            \"uid\": \"2282-e956ff02-7597-4f8d-a5e7-1c18208c9e56\"\n        }\n    ]\n}"
    },
    {
      "name": "Success: Import a file",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "type",
              "value": "file",
              "type": "text"
            },
            {
              "key": "input",
              "value": "",
              "description": "A file with the specifications",
              "type": "file"
            }
          ]
        },
        "url": {
          "raw": "https://api.getpostman.com/import/openapi",
          "protocol": "https",
          "host": [
            "api",
            "getpostman",
            "com"
          ],
          "path": [
            "import",
            "openapi"
          ],
          "variable": [
            {
              "key": "import_type",
              "value": ""
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json",
          "description": {
            "content": "",
            "type": "text/plain"
          }
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"collections\": [\n        {\n            \"id\": \"c74f2169-0c59-49f6-b04f-fdec4aba3db3\",\n            \"name\": \"demo\",\n            \"uid\": \"2282-c74f2169-0c59-49f6-b04f-fdec4aba3db3\"\n        },\n        {\n            \"id\": \"49b08197-6b3d-4957-88d3-dbba0e3ee6a0\",\n            \"name\": \"demo\",\n            \"uid\": \"2282-49b08197-6b3d-4957-88d3-dbba0e3ee6a0\"\n        }\n    ]\n}"
    },
    {
      "name": "Success: Import - Stringified body",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "name": "Content-Type",
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"type\": \"string\",\n  \"input\": \" {\\r\\n    \\\"openapi\\\": \\\"3.0.0\\\",\\r\\n    \\\"info\\\": {\\r\\n  \\t  \\\"version\\\": \\\"1.0.0\\\",\\r\\n  \\t  \\\"title\\\": \\\"Swagger Petstore\\\",\\r\\n  \\t  \\\"license\\\": {\\r\\n  \\t    \\\"name\\\": \\\"MIT\\\"\\r\\n  \\t  }\\r\\n    },\\r\\n    \\\"servers\\\": [\\r\\n      {\\r\\n        \\\"url\\\": \\\"http:\\/\\/petstore.swagger.io\\/v1\\\"\\r\\n      }\\r\\n    ],\\r\\n    \\\"paths\\\": {\\r\\n  \\t  \\\"\\/pets\\\": {\\r\\n        \\\"get\\\": {\\r\\n          \\\"summary\\\": \\\"List all pets\\\",\\r\\n          \\\"operationId\\\": \\\"listPets\\\",\\r\\n          \\\"parameters\\\": [\\r\\n            {\\r\\n              \\\"name\\\": \\\"limit\\\",\\r\\n              \\\"in\\\": \\\"query\\\",\\r\\n              \\\"description\\\": \\\"limit\\\",\\r\\n              \\\"required\\\": false,\\r\\n              \\\"schema\\\": {\\r\\n                \\\"type\\\": \\\"integer\\\",\\r\\n                \\\"format\\\": \\\"int32\\\"\\r\\n              }\\r\\n            }\\r\\n          ],\\r\\n          \\\"responses\\\": {\\r\\n            \\\"default\\\": {\\r\\n              \\\"description\\\": \\\"unexpected error\\\",\\r\\n              \\\"content\\\": {\\r\\n                \\\"application\\/json\\\": {\\r\\n                  \\\"schema\\\": {\\r\\n                    \\\"$ref\\\": \\\"#\\/components\\/schemas\\/Error\\\"\\r\\n                  }\\r\\n                }\\r\\n              }\\r\\n            }\\r\\n          }\\r\\n        }\\r\\n      }\\r\\n    },\\r\\n    \\\"components\\\": {\\r\\n      \\\"schemas\\\": {\\r\\n        \\\"Error\\\": {\\r\\n          \\\"required\\\": [\\r\\n            \\\"code\\\",\\r\\n            \\\"message\\\"\\r\\n          ],\\r\\n          \\\"properties\\\": {\\r\\n            \\\"code\\\": {\\r\\n              \\\"type\\\": \\\"integer\\\",\\r\\n              \\\"format\\\": \\\"int32\\\"\\r\\n            },\\r\\n            \\\"message\\\": {\\r\\n              \\\"type\\\": \\\"string\\\"\\r\\n            }\\r\\n          }\\r\\n        }\\r\\n      }\\r\\n    }\\r\\n  }\\r\\n\"\n}"
        },
        "url": {
          "raw": "https://api.getpostman.com/import/openapi",
          "protocol": "https",
          "host": [
            "api",
            "getpostman",
            "com"
          ],
          "path": [
            "import",
            "openapi"
          ],
          "variable": [
            {
              "key": "import_type",
              "value": "openapi"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json",
          "description": {
            "content": "",
            "type": "text/plain"
          }
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"collections\": [\n        {\n            \"id\": \"401fcf93-9c45-4832-9616-6c6b698eeda6\",\n            \"name\": \"Swagger Petstore\",\n            \"uid\": \"2282-401fcf93-9c45-4832-9616-6c6b698eeda6\"\n        }\n    ]\n}"
    },
    {
      "name": "Success: Import to a specific workspace with workspace ID passed as a query parameter",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "name": "Content-Type",
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"type\" : \"json\",\n  \"input\": {\n    \"openapi\": \"3.0.0\",\n    \"info\": {\n  \t  \"version\": \"1.0.0\",\n  \t  \"title\": \"Swagger Petstore\",\n  \t  \"license\": {\n  \t    \"name\": \"MIT\"\n  \t  }\n    },\n    \"servers\": [\n      {\n        \"url\": \"http://petstore.swagger.io/v1\"\n      }\n    ],\n    \"paths\": {\n  \t  \"/pets\": {\n        \"get\": {\n          \"summary\": \"List all pets\",\n          \"operationId\": \"listPets\",\n          \"parameters\": [\n            {\n              \"name\": \"limit\",\n              \"in\": \"query\",\n              \"description\": \"limit\",\n              \"required\": false,\n              \"schema\": {\n                \"type\": \"integer\",\n                \"format\": \"int32\"\n              }\n            }\n          ],\n          \"responses\": {\n            \"default\": {\n              \"description\": \"unexpected error\",\n              \"content\": {\n                \"application/json\": {\n                  \"schema\": {\n                    \"$ref\": \"#/components/schemas/Error\"\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    },\n    \"components\": {\n      \"schemas\": {\n        \"Error\": {\n          \"required\": [\n            \"code\",\n            \"message\"\n          ],\n          \"properties\": {\n            \"code\": {\n              \"type\": \"integer\",\n              \"format\": \"int32\"\n            },\n            \"message\": {\n              \"type\": \"string\"\n            }\n          }\n        }\n      }\n    }\n  }\n}"
        },
        "url": {
          "raw": "https://api.getpostman.com/import/openapi?workspace=c90a3482-f80d-43d6-9dfb-0830f5e43605",
          "protocol": "https",
          "host": [
            "api",
            "getpostman",
            "com"
          ],
          "path": [
            "import",
            "openapi"
          ],
          "query": [
            {
              "key": "workspace",
              "value": "c90a3482-f80d-43d6-9dfb-0830f5e43605"
            }
          ],
          "variable": [
            {
              "key": "import_type",
              "value": "openapi"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json",
          "description": {
            "content": "",
            "type": "text/plain"
          }
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"collections\": [\n        {\n            \"id\": \"b31be584-1b1e-4444-b581-761edf88fe77\",\n            \"name\": \"Swagger Petstore\",\n            \"uid\": \"2282-b31be584-1b1e-4444-b581-761edf88fe77\"\n        }\n    ]\n}"
    },
    {
      "name": "Error: Invalid Params",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "name": "Content-Type",
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"type\" : \"invalid_type\",\n  \"input\": {\n    \"openapi\": \"3.0.0\",\n    \"info\": {\n  \t  \"version\": \"1.0.0\",\n  \t  \"title\": \"Swagger Petstore\",\n  \t  \"license\": {\n  \t    \"name\": \"MIT\"\n  \t  }\n    },\n    \"servers\": [\n      {\n        \"url\": \"http://petstore.swagger.io/v1\"\n      }\n    ],\n    \"paths\": {\n  \t  \"/pets\": {\n        \"get\": {\n          \"summary\": \"List all pets\",\n          \"operationId\": \"listPets\",\n          \"parameters\": [\n            {\n              \"name\": \"limit\",\n              \"in\": \"query\",\n              \"description\": \"limit\",\n              \"required\": false,\n              \"schema\": {\n                \"type\": \"integer\",\n                \"format\": \"int32\"\n              }\n            }\n          ],\n          \"responses\": {\n            \"default\": {\n              \"description\": \"unexpected error\",\n              \"content\": {\n                \"application/json\": {\n                  \"schema\": {\n                    \"$ref\": \"#/components/schemas/Error\"\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    },\n    \"components\": {\n      \"schemas\": {\n        \"Error\": {\n          \"required\": [\n            \"code\",\n            \"message\"\n          ],\n          \"properties\": {\n            \"code\": {\n              \"type\": \"integer\",\n              \"format\": \"int32\"\n            },\n            \"message\": {\n              \"type\": \"string\"\n            }\n          }\n        }\n      }\n    }\n  }\n}"
        },
        "url": {
          "raw": "https://api.getpostman.com/import/openapi",
          "protocol": "https",
          "host": [
            "api",
            "getpostman",
            "com"
          ],
          "path": [
            "import",
            "openapi"
          ],
          "variable": [
            {
              "key": "import_type",
              "value": "openapi"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json",
          "description": {
            "content": "",
            "type": "text/plain"
          }
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"error\": {\n        \"name\": \"invalidParamsError\",\n        \"message\": \"The request body has invalid values for the type parameter. Value must be one of file, string, json\",\n        \"details\": {\n            \"param\": \"type\"\n        }\n    }\n}"
    },
    {
      "name": "Error: Param Missing",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "name": "Content-Type",
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
          ]
        },
        "url": {
          "raw": "https://api.getpostman.com/import/openapi",
          "protocol": "https",
          "host": [
            "api",
            "getpostman",
            "com"
          ],
          "path": [
            "import",
            "openapi"
          ],
          "variable": [
            {
              "key": "import_type",
              "value": "openapi"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json",
          "description": {
            "content": "",
            "type": "text/plain"
          }
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"error\": {\n        \"name\": \"paramMissingError\",\n        \"message\": \"The request body is missing a value for the type parameter. Check your request and try again.\",\n        \"details\": {\n            \"param\": \"type\"\n        }\n    }\n}"
    },
    {
      "name": "Error: Malformed Request",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "name": "Content-Type",
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"type\" : \"json\",\n  \"input\": {\n    \"info\": {\n  \t  \"version\": \"1.0.0\",\n  \t  \"title\": \"Swagger Petstore\",\n  \t  \"license\": {\n  \t    \"name\": \"MIT\"\n  \t  }\n    },\n    \"servers\": [\n      {\n        \"url\": \"http://petstore.swagger.io/v1\"\n      }\n    ],\n    \"paths\": {\n  \t  \"/pets\": {\n        \"get\": {\n          \"summary\": \"List all pets\",\n          \"operationId\": \"listPets\",\n          \"parameters\": [\n            {\n              \"name\": \"limit\",\n              \"in\": \"query\",\n              \"description\": \"limit\",\n              \"required\": false,\n              \"schema\": {\n                \"type\": \"integer\",\n                \"format\": \"int32\"\n              }\n            }\n          ],\n          \"responses\": {\n            \"default\": {\n              \"description\": \"unexpected error\",\n              \"content\": {\n                \"application/json\": {\n                  \"schema\": {\n                    \"$ref\": \"#/components/schemas/Error\"\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    },\n    \"components\": {\n      \"schemas\": {\n        \"Error\": {\n          \"required\": [\n            \"code\",\n            \"message\"\n          ],\n          \"properties\": {\n            \"code\": {\n              \"type\": \"integer\",\n              \"format\": \"int32\"\n            },\n            \"message\": {\n              \"type\": \"string\"\n            }\n          }\n        }\n      }\n    }\n  }\n}"
        },
        "url": {
          "raw": "https://api.getpostman.com/import/openapi",
          "protocol": "https",
          "host": [
            "api",
            "getpostman",
            "com"
          ],
          "path": [
            "import",
            "openapi"
          ],
          "variable": [
            {
              "key": "import_type",
              "value": "openapi"
            }
          ]
        }
      },
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json",
          "description": {
            "content": "",
            "type": "text/plain"
          }
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"error\": {\n        \"name\": \"malformedRequestError\",\n        \"message\": \"The specified openapi data is invalid. Please fix the following details as per the spec.\",\n        \"details\": \"Specification must contain a semantic version number of the OAS specification\"\n    }\n}"
    }
  ]
}