Chilkat Online Tools

Node.js / Datadog API Collection / Upload IdP metadata

Back to Collection Items

var os = require('os');
if (os.platform() == 'win32') {  
    if (os.arch() == 'ia32') {
        var chilkat = require('@chilkat/ck-node21-win-ia32');
    } else {
        var chilkat = require('@chilkat/ck-node21-win64'); 
    }
} else if (os.platform() == 'linux') {
    if (os.arch() == 'arm') {
        var chilkat = require('@chilkat/ck-node21-arm');
    } else if (os.arch() == 'x86') {
        var chilkat = require('@chilkat/ck-node21-linux32');
    } else {
        var chilkat = require('@chilkat/ck-node21-linux64');
    }
} else if (os.platform() == 'darwin') {
    if (os.arch() == 'arm64') {
        var chilkat = require('@chilkat/ck-node21-mac-m1');
    } else {
        var chilkat = require('@chilkat/ck-node21-macosx');
    }
}


function chilkatExample() {

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

    var http = new chilkat.Http();
    var success;

    var req = new chilkat.HttpRequest();
    req.HttpVerb = "POST";
    req.Path = "/api/v2/saml_configurations/idp_metadata";
    req.ContentType = "multipart/form-data";
    req.AddParam("idp_file","<string>");

    req.AddHeader("Accept","application/json");

    // resp: HttpResponse
    var resp = http.SynchronousRequest("api.app.ddog-gov.com",443,true,req);
    if (http.LastMethodSuccess == false) {
        console.log(http.LastErrorText);
        return;
    }

    console.log(resp.StatusCode);
    console.log(resp.BodyStr);


}

chilkatExample();

Curl Command

curl -X POST
	-H "Content-Type: multipart/form-data"
	-H "Accept: application/json"
	--form 'idp_file=<string>'
https://api.app.ddog-gov.com/api/v2/saml_configurations/idp_metadata

Postman Collection Item JSON

{
  "name": "Upload IdP metadata",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "value": "multipart/form-data"
      },
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "body": {
      "mode": "formdata",
      "formdata": [
        {
          "key": "idp_file",
          "value": "<string>",
          "description": "The IdP metadata XML file",
          "type": "text"
        }
      ]
    },
    "url": {
      "raw": "{{baseUrl}}/api/v2/saml_configurations/idp_metadata",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v2",
        "saml_configurations",
        "idp_metadata"
      ]
    },
    "description": "Endpoint for uploading IdP metadata for SAML setup.\n\nUse this endpoint to upload or replace IdP metadata for SAML login configuration."
  },
  "response": [
    {
      "name": "OK",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "multipart/form-data"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "idp_file",
              "value": "<string>",
              "description": "The IdP metadata XML file",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/api/v2/saml_configurations/idp_metadata",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "saml_configurations",
            "idp_metadata"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Bad Request",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "multipart/form-data"
          },
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "idp_file",
              "value": "<string>",
              "description": "The IdP metadata XML file",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/api/v2/saml_configurations/idp_metadata",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "saml_configurations",
            "idp_metadata"
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    \"<string>\",\n    \"<string>\"\n  ]\n}"
    },
    {
      "name": "Forbidden",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "multipart/form-data"
          },
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "idp_file",
              "value": "<string>",
              "description": "The IdP metadata XML file",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/api/v2/saml_configurations/idp_metadata",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "saml_configurations",
            "idp_metadata"
          ]
        }
      },
      "status": "Forbidden",
      "code": 403,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    \"<string>\",\n    \"<string>\"\n  ]\n}"
    },
    {
      "name": "Too many requests",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "multipart/form-data"
          },
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "idp_file",
              "value": "<string>",
              "description": "The IdP metadata XML file",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/api/v2/saml_configurations/idp_metadata",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "saml_configurations",
            "idp_metadata"
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    \"<string>\",\n    \"<string>\"\n  ]\n}"
    }
  ]
}