Tanay_Suthar is having trouble finding the API call to create a Data Explorer query. pfaffman suggests reverse-engineering the Discourse API.
After trying this, Tanay_Suthar realizes that two separate calls are needed: a POST call to /admin/plugins/explorer/queries to generate a query ID, and a PUT call to /admin/plugins/explorer/queries/id to edit the query. However, Tanay_Suthar wonders if it’s possible to create a query in a single API call without knowing the ID.
Arkshine suggests making a POST request with the same payload values as PUT. Tanay_Suthar tries this but gets an internal server error. Arkshine then provides the correct way to format the query, using -F 'query[name]=test1234' -F 'query[sql]=SELECT * FROM topics'. This solution works, as confirmed by Tanay_Suthar.