Import json file but got "Error while importing: format not recognized"

Hello all,
I got “Error while importing:format not recongnized” error when I wanted to import my swagger json to postman

My step:
export swagger json file → import (postman) → upload files → error

I didn’t find the answer of my problem in the other topics, I didn’t find any clue using google also, so I just suspect maybe there are some error format in my json file. can some one look this issue and give me some help, grateful thanks :)

other try:
I edit json file “swagger”: “2.0” to “openapi”: “2.0” but it didnot work neither

here are my json I used

{
	"swagger": "2.0",
	"paths": {
		"/actuator/health": {
			"get": {
				"consumes": [
					"application/json"
				],
				"produces": [
					"application/json"
				],
				"tags": [
					"actuator"
				],
				"summary": "get all services",
				"operationId": "CheckHeath",
				"parameters": [{
					"name": "body",
					"in": "body",
					"required": true,
					"schema": {
						"$ref": "#/definitions/actuator.CheckHealthReq"
					}
				}],
				"responses": {
					"200": {
						"description": "OK",
						"schema": {
							"$ref": "#/definitions/actuator.HealthRsp"
						}
					}
				}
			}
		},
		"/api/v1/approval/service/{id}/start": {
			"post": {
				"consumes": [
					"application/json"
				],
				"produces": [
					"application/json"
				],
				"tags": [
					"approval"
				],
				"summary": "submit start service approval application",
				"operationId": "SubmitStartApprovalApplication",
				"parameters": [{
						"type": "string",
						"description": "application id",
						"name": "id",
						"in": "path",
						"required": true
					},
					{
						"name": "body",
						"in": "body",
						"required": true,
						"schema": {
							"$ref": "#/definitions/serving.StartServiceApplication"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"schema": {
							"$ref": "#/definitions/serving.StartServiceApplication"
						}
					}
				}
			}
		}
	}
}
````json
1 Like

I’m having the same issue but while trying to import collection using swagger link, help will be much appreciated. TIA

Swagger link: Swagger UI

Postman Version

Hi @spacecraft-administ8,

I am having the same problem all of a sudden, and now Swagger docs that previously imported without error are returning “Error while importing: format not recognized”

did you ever manage to solve this issue?

regards,
Dyllon

for those that are perhaps still experiencing this issue… I’ve switched to APIDog and can now use swaggers again.

@spacecraft-administ8 The file you are trying to import is invalid Swagger 2.0 file. “info” is a required parameter. Here is the corrected file, which I am able to import

{
	"swagger": "2.0",
	"info": {
	  "title": "test",
	  "version": "1.0.0"
	},
	"paths": {
		"/actuator/health": {
			"get": {
				"consumes": [
					"application/json"
				],
				"produces": [
					"application/json"
				],
				"tags": [
					"actuator"
				],
				"summary": "get all services",
				"operationId": "CheckHeath",
				"parameters": [{
					"name": "body",
					"in": "body",
					"required": true,
					"schema": {
						"$ref": "#/definitions/actuator.CheckHealthReq"
					}
				}],
				"responses": {
					"200": {
						"description": "OK",
						"schema": {
							"$ref": "#/definitions/actuator.HealthRsp"
						}
					}
				}
			}
		},
		"/api/v1/approval/service/{id}/start": {
			"post": {
				"consumes": [
					"application/json"
				],
				"produces": [
					"application/json"
				],
				"tags": [
					"approval"
				],
				"summary": "submit start service approval application",
				"operationId": "SubmitStartApprovalApplication",
				"parameters": [{
						"type": "string",
						"description": "application id",
						"name": "id",
						"in": "path",
						"required": true
					},
					{
						"name": "body",
						"in": "body",
						"required": true,
						"schema": {
							"$ref": "#/definitions/serving.StartServiceApplication"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"schema": {
							"$ref": "#/definitions/serving.StartServiceApplication"
						}
					}
				}
			}
		}
	}
}
2 Likes

Very helpful.

I was importing the API for NetWorker (NetWorker_REST_API_v3.json), and I kept getting the “Error while importing: format not recognized” when importing.

The “info” parameter in the JSON was missing the version. The JSON imported successfully, once I added the version.

 "info": {
    "description": "The NetWorker REST API is available in the following base URI:<br>&nbsp;&nbsp;https://{nw-server-hostname}:9090/nwrestapi/v3<br><br>",
    "version": "3.0.0",
    "title": "NetWorker REST API RESOURCE REFERENCE",
    "contact": {
      "name": "REST API TEAM"
    },
    "license": {
      "name": "Copyright © 1990-2021 Dell Inc. or its subsidiaries. All rights reserved.",
      "url": "https://www.dellemc.com"
    }
  },
  "basePath": "/nwrestapi/v3/global",
  "securityDefinitions": {
    "apiSecurity": {
      "type": "basic"
    }
  }

Thanks!

Thanks- That worked :slight_smile:

1 Like