How to create a data explorer query with the APIs?

Here is the query which I tried by making POST API call.

curl -X POST https://api-discourse-XXXXXXXXXXXXX/admin/plugins/explorer/queries
-H “Content-Type: multipart/form-data;”
-H “Api-Key: 46811cc32XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”
-H “Api-Username: abcdefg2”
-F ‘query={“name”:“test1234”, “sql”:“SELECT * FROM topics”}’

However, I’m getting an error as below.

{“status”:500,“error”:“Internal Server Error”}%

Not sure what could be wrong.