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

3
  • 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. Commented Feb 23, 2022 at 0:02
  • I'd suggest using POSTman if you are not comfortable using curl or quoting JSON on the commandline Commented Feb 23, 2022 at 0: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 to the linked duplicate for details. Commented Feb 23, 2022 at 2:13

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.