scarvy
October 15, 2023, 7:47pm
1
When using a POST request to the generate ENDPOINT for either SQL or XML format, result in an error:
XML- {“error”:“undefined method `xml_root_element’ for nil:NilClass”}
SQL - {“error”:“undefined method `table_name’ for nil:NilClass”}
I tried passing a table_name query parameter for the SQL format like:
requests.post(“https://api.mockaroo.com/api/generate.sql schema=Person&table_name=personkey=my_api_key”)
As see other users are having similar issues:
When using a POST to the generate endpoint (eg: https://api.mockaroo.com/api/generate.sql?key=ABCDEFG&schema=mySchemaName) specifying the SQL type results in an error:
{“error”:“undefined method `table_name’ for nil:NilClass”}
The same call to generate.json or generate.csv etc works as expected.
Passing table_name as an additional query param does not help.
Has anyone been able to correctly use the POST endpoint to generate SQL inserts?
Has anyone else encountered these errors and found a solution? I’ve tried various combinations of query parameters without success. Any help or insights from Mockaroo support would also be appreciated.
Thanks in advance.
This should be fixed now.
scarvy
October 23, 2023, 1:47am
3
Thank you!
The “XML” format seems to be working correctly, but I’m still receiving an error message for the “SQL” format. The error message states “undefined method `table_name’ for nil:NilClass”.
Here is my URL request: https://api.mockaroo.com/api/generate.sql?schema=Person&table_name=person&client=python&key={my_key}
SQL should now be fixed as well.
scarvy
October 23, 2023, 5:00pm
5
Thanks, it is working now!