1

I'm executing the following command but I'm getting error on JSON format

PS C:\Program Files\PostgreSQL\12\bin> curl.exe -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" localhost:8083/connectors/ -d '{"name": "sde-connector", "config": {"connector.class": "io.debezium.connector.postgresql.PostgresConnector", "database.hostname": "postgres", "database.port": "5432", "database.user": "postgres", "database.password": "password", "database.dbname": "postgres", "database.server.name": "bankserver1", "table.whitelist": "bank.holding"}}'
HTTP/1.1 500 Internal Server Error
Date: Tue, 22 Feb 2022 23:00:52 GMT
Content-Type: application/json
Content-Length: 240
Server: Jetty(9.4.20.v20190813)

{"error_code":500,"message":"Unexpected character ('n' (code 110)): was expecting double-quote to start field name\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 3]"}
PS C:\Program Files\PostgreSQL\12\bin>

tried the suggestion to put \"name\" but it doesn't work

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
x117342
  • 23
  • 2
  • 1
    The double quotes are used by the command line, but are mandatory in json on the first `name`. Wrap all in a single quote or use a file. – Joop Eggen Feb 23 '22 at 00:02
  • I'd suggest using POSTman if you are not comfortable using curl or quoting JSON on the commandline – OneCricketeer Feb 23 '22 at 00:12
  • The sad reality as of PowerShell 7.2 is that an _extra, manual_ layer of `\ `-escaping of embedded `"` characters is required in arguments passed to _external programs_. This _may_ get fixed in a future version, which _may_ require opt-in. See [this answer](https://stackoverflow.com/a/66837948/45375) to the linked duplicate for details. – mklement0 Feb 23 '22 at 02:13

0 Answers0