Parameter is missing in the request

I’m having trouble POSTing to the Postman API. I had this all working about a month ago, I’ve now returned to the project, but now I constantly get the error:

{
“error”: {
“name”: “paramMissingError”,
“message”: “Parameter is missing in the request.”
}
}

To isolate the issue, I’m no longer using my solution. I’m using the example post from Postman API docs. I’ve also tried using the example postman API collection in the postman UI (when you click the “Run in Postman” from the above docs and it loads a collection into Postman). From these examples, all I change is the “X-Api-Key”. Other things I’ve checked:

  • I’ve made sure I haven’t gone over my API request quoter
  • I’ve replaced my integration key with a new one
  • I’ve used an entirely new Account with a new integration key

This is the example post data supplied by postmanlabs:

	{
  "collection": {
    "info": {
      "name": "Sample Collection {{$randomInt}}",
      "description": "This is just a sample collection.",
      "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "item": [
      {
        "name": "This is a folder",
        "item": [
          {
            "name": "Sample POST Request",
            "request": {
              "url": "https://postman-echo.com/post",
              "method": "POST",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": {
                "mode": "raw",
                "raw": "{\"data\": \"123\"}"
              },
              "description": "This is a sample POST Request"
            }
          }
        ]
      },
      {
        "name": "Sample GET Request",
        "request": {
          "url": "https://postman-echo/get",
          "method": "GET",
          "description": "This is a sample GET Request"
        }
      }
    ]
  }
}

This is the sample node script that fails:

var https = require('https');

var options = {
  'method': 'POST',
  'hostname': 'api.getpostman.com',
  'path': '/collections',
  'headers': {
    'X-Api-Key': '{{postman_api_key}}',
    'Content-Type': 'application/json'
  }
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData =  "{\n  \"collection\": {\n    \"variables\": [],\n    \"info\": {\n      \"name\": \"Sample Collection\",\n      \"description\": \"This is just a sample collection.\",\n      \"schema\": \"https://schema.getpostman.com/json/collection/v2.0.0/collection.json\"\n    },\n    \"item\": [\n      {\n        \"name\": \"This is a folder\",\n        \"description\": \"\",\n        \"item\": [\n          {\n            \"name\": \"Sample POST Request\",\n            \"request\": {\n              \"url\": \"echo.getpostman.com/post\",\n              \"method\": \"POST\",\n              \"header\": [\n                {\n                  \"key\": \"Content-Type\",\n                  \"value\": \"application/json\",\n                  \"description\": \"\"\n                }\n              ],\n              \"body\": {\n                \"mode\": \"raw\",\n                \"raw\": \"{\\n\\t\\\"data\\\": \\\"123\\\"\\n}\"\n              },\n              \"description\": \"This is a sample POST Request\"\n            },\n            \"response\": []\n          }\n        ]\n      },\n      {\n        \"name\": \"Sample GET Request\",\n        \"request\": {\n          \"url\": \"echo.getpostman.com/get\",\n          \"method\": \"GET\",\n          \"header\": [],\n          \"body\": {\n            \"mode\": \"formdata\",\n            \"formdata\": []\n          },\n          \"description\": \"This is a sample GET Request\"\n        },\n        \"response\": []\n      }\n    ]\n  }\n}";

req.write(postData);

req.end();
1 Like