---
title: Edit Datasource
slug: single-connect-api-3-2-0/edit-datasource
description: Learn how to use the curl command to make a POST request and update a datasource in this code example. The provided tutorial includes headers for JSON acceptance and content type specification, with the request body presented as a string. Boost your knowl
docTags: 
createdAt: 2022-11-10T14:24:52.000Z
---

{
  "id": "T8FTTtYfSepl_6iZ7E_wO",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/sc/sqlproxy/updateDatasource",
    "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    \"dbId\": 582601,\r\n    \"name\": \"new datasource\",\r\n    \"description\": \"new datasource\",\r\n    \"url\": \"jdbc:oracle:thin:@10.20.40.92:1521:TESTDB\",\r\n    \"maxThreadCount\": null,\r\n    \"databaseDriver\": \"Oracle\",\r\n    \"username\": \"Username\",\r\n    \"password\": \"Password\"\r\n}",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "This method enables user to edit previously saved datasources.\r\ndbId of the method should be posted correctly. Other properties can be edited.",
    "examples": {
      "languages": [
        {
          "id": "bUThPBU_7v3I-v1ZGUNQQ",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/sc/sqlproxy/updateDatasource \\\n     --header 'accept: application/json'"
        },
        {
          "id": "7bNj1QyT4Zgj3v7li-I1K",
          "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/updateDatasource\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "yrwBfhCjm2A6odFgrSgrD",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/sc/sqlproxy/updateDatasource\")\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": "abaQyk9vbFgG86hy8Tr6t",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"{{url}}/aioc-rest-web/rest/sc/sqlproxy/updateDatasource\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "bUThPBU_7v3I-v1ZGUNQQ"
    },
    "results": {
      "languages": [
        {
          "id": "8OQpa8WG50-YaQhk9qqAd",
          "language": "200",
          "code": ""
        }
      ],
      "selectedLanguageId": "8OQpa8WG50-YaQhk9qqAd"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}