---
title: Save Masking Policy
slug: single-connect-api-3-2-0/save-masking-policy
description: Learn how to make a POST request in cURL using a code example provided in this document. The code showcases the process of sending a request to save a masking policy in a web application, including specific headers and payload in JSON format. Improve your
docTags: 
createdAt: 2022-11-10T14:24:52.000Z
---

{
  "id": "QIIcOoGzgaQhBNzpzofZ8",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/sc/sqlproxy/saveMaskingPolicy",
    "method": "POST",
    "request": {
      "pathParameters": [],
      "queryParameters": [],
      "headerParameters": [
        {
          "name": "Content-Type",
          "type": "string",
          "example": "application/json",
          "description": ""
        },
        {
          "name": "X-XSRF-TOKEN",
          "type": "string",
          "example": "{{csrftoken}}",
          "description": ""
        }
      ],
      "bodyDataParameters": [
        {
          "name": "body",
          "type": "string",
          "example": "{\r\n    \"name\": \"new policy\",\r\n    \"description\": \"new masking policy\",\r\n    \"datasourceDbId\": 582647,\r\n    \"active\": true,\r\n    \"rowLimit\": 50,\r\n    \"schema\": \"*\",\r\n    \"table\": \"EMPLOYEES\",\r\n    \"column\": \"FIRST_NAME\",\r\n    \"methodDbId\": 465445\r\n}",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "<p>This method saves a new masking policy.\r\nTo use this method, the masking method and datasource should be saved firstly. The dbIds of the related records should be posted in the methodDbId and datasourceDbId properties.\r\nSchema, table and column values of the target database should be entered. If the user wants to mask entire columns/tables or schemas in the database, \"<em>\" can be entered. All these three values should not be set \"</em>\" in the same time.</p>",
    "examples": {
      "languages": [
        {
          "id": "Bc4csXeaIWmT70Ncc2StJ",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/sc/sqlproxy/saveMaskingPolicy \\\n     --header 'accept: application/json'"
        },
        {
          "id": "9U3esWEbXl25Zo3HxhGqw",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"{{url}}/aioc-rest-web/rest/sc/sqlproxy/saveMaskingPolicy\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "l29MqWF5nW27DovVoHzqU",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/sc/sqlproxy/saveMaskingPolicy\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "DV4HugCAJqbFeRf4kKPzb",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"{{url}}/aioc-rest-web/rest/sc/sqlproxy/saveMaskingPolicy\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "Bc4csXeaIWmT70Ncc2StJ"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": ""
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}