Issues with Import exported data via the Postman API

I have been trying to use the “Import exported data” functionality with the API.

I have followed the instructions but have been unable to get this working.
I have used the examples in multiple languages but to no avail.

All requests with the expected parameters, hit the request timeout limit.
If i purposefully remove a parameter, i get the expected error messages.

An example curl gives me the following:

curl --location --request POST "https://api.getpostman.com/import/exported?workspace={{workspaceId}}" \
  --header "x-api-key: {{postman_api_key}}" \
  --header "Content-Type: application/json" \
  --form "type=file" \
  --form "input=@" 

output:

*   Trying 3.222.41.251...
* TCP_NODELAY set
* Connected to api.getpostman.com (3.222.41.251) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.postman.co
* Server certificate: Amazon
* Server certificate: Amazon Root CA 1
* Server certificate: Starfield Services Root Certificate Authority - G2
> POST /import/exported?workspace={{workspaceId}} HTTP/1.1
> Host: api.getpostman.com
> User-Agent: curl/7.54.0
> Accept: */*
> x-api-key: {{postman_api_key}}
> Content-Length: 673700
> Expect: 100-continue
> Content-Type: application/json; boundary=------------------------31c90a184cc5125b
>
< HTTP/1.1 100 Continue
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/plain; charset=utf-8
< Date: Wed, 21 Aug 2019 08:50:41 GMT
< ETag: W/"15-/6VXivhc2MKdLfIkLcUE47K6aH0"
< Server: nginx
< Content-Length: 21
< Connection: keep-alive
* HTTP error before end of send, stop sending
<
* Closing connection 0
Internal Server Error% ```

Thanks in advance.

Please be so kind and share the code that you are using and the exact error that you are getting.

How big is the file you are importing?

Hi,

Thanks for the reply, as specified above here is the CURL i ran and the output.

curl --location --request POST "https://api.getpostman.com/import/exported?workspace={{workspaceId}}" \
  --header "x-api-key: {{postman_api_key}}" \
  --header "Content-Type: application/json" \
  --form "type=file" \
  --form "input=@" 

output:

*   Trying 3.222.41.251...
* TCP_NODELAY set
* Connected to api.getpostman.com (3.222.41.251) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.postman.co
* Server certificate: Amazon
* Server certificate: Amazon Root CA 1
* Server certificate: Starfield Services Root Certificate Authority - G2
> POST /import/exported?workspace={{workspaceId}} HTTP/1.1
> Host: api.getpostman.com
> User-Agent: curl/7.54.0
> Accept: */*
> x-api-key: {{postman_api_key}}
> Content-Length: 673700
> Expect: 100-continue
> Content-Type: application/json; boundary=------------------------31c90a184cc5125b
>
< HTTP/1.1 100 Continue
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/plain; charset=utf-8
< Date: Wed, 21 Aug 2019 08:50:41 GMT
< ETag: W/"15-/6VXivhc2MKdLfIkLcUE47K6aH0"
< Server: nginx
< Content-Length: 21
< Connection: keep-alive
* HTTP error before end of send, stop sending
<
* Closing connection 0
Internal Server Error% 

I am also running the following in Ruby and also receive a timeout as the request just hangs.
I have removed all the keys etc. from the code

require 'faraday'
require 'logger'
conn = Faraday.new('https://api.getpostman.com') do |f|
  f.request :multipart
  f.request :url_encoded
  f.response :logger, Logger.new(STDOUT), bodies: true
  f.adapter :net_http # This is what ended up making it work
end

payload = {"type" => "file", :input => Faraday::UploadIO.new('fileneame.zip', 'application/zip') }

headers = {"x-api-key" => "{{api_key}}"} 

resp = conn.post('/import/exported?workspace={{workspace_id}}', payload, headers)
puts resp ```

output: 

Net::ReadTimeout (Faraday::TimeoutError)```

If i run the Postman test collection for the API in the desktop app and remove all timeout limits, it also hangs and after a few minutes i receive:

<html>

<head>
	<title>504 Gateway Time-out</title>
</head>

<body bgcolor="white">
	<center>
		<h1>504 Gateway Time-out</h1>
	</center>
	<hr>
	<center>nginx</center>
</body>

</html>

Also the file is 674kb.

It looks that you are uploading a zip file, but I think Postman expects a JSON file.

It should be the file that you have manually dumped: Backup.postman_dump.json

I have just tried that and i receive an error.

{
    "error": {
        "name": "malformedRequestError",
        "message": "The request body has invalid data as input. Input a valid zip file containing archive.json and a folder with Postman collections",
        "details": {
            "param": "input"
        }
    }
}

When following the documentation it asks you to download your data / export from the following URL.

https://go.postman.co/me/export

Ok, my bad.

It needs to be a zip file with the following:

  • archive.json with a contents like this:

    {
    “collection”: {
    “00c9f952-916a-4c15-9f02-aac109e4cd9e”: true
    }
    }

  • folder called collection with files like this:
    00c9f952-916a-4c15-9f02-aac109e4cd9e.json

Can you confirm you have something similar?

I do have that file, i have checked that the format is ok and that it matches what you have suggested. I have exported numerous files and they all seem to have the correct format.

It is rather odd.

This has been raised as a bug: https://github.com/postmanlabs/postman-app-support/issues/7257