cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Errors calling databricks rest api /api/2.1/jobs/run-now with job_parameters

ErikJ
New Contributor III

Hello! I have been using the databricks rest api for running workflows using this endpoint: /api/2.1/jobs/run-now. But now i wanted to also include job_parameters in my api call, i have put job parameters inside my workflow: param1, param2, and in my call to the api im sending this:

params ={"job_id" : 12312312

"job_parameters":{"param1":"12",

"param2":"test"},}. But for some reason i get following response:  {'error_code': 'MALFORMED_REQUEST', 'message': "Could not parse request object: Expected 'START_OBJECT' not 'VALUE_STRING'\n at....

Anyone knows what the problem may be? Ive also just copied the sample request as specified in documentation:https://docs.databricks.com/api/azure/workspace/jobs/runnow#job_parameters but its not working either.

 

2 REPLIES 2

filipniziol
Contributor

Hi @ErikJ ,

 

Are you sending a POST request to the /api/2.1/jobs/run-now endpoint? It's important to use a POST request because this endpoint expects the parameters to be included in the request body as JSON, not as query parameters.

Also, your "params" seem malformed, with a missing comma after "job_id": 12312312 and an extra comma after "job_parameters". This might just be due to copy-pasting, but incorrect JSON formatting can cause the MALFORMED_REQUEST error you're seeing.

Here's how your JSON body should look:

{
  "job_id" : 12312312,
  "job_parameters":
  {
     "param1":"12",
     "param2":"test"
  }
}

 Additional Notes:

  • Ensure Correct HTTP Headers: Make sure you're setting the Content-Type header to application/json in your POST request.
  • Validate Your JSON: It's a good idea to validate your JSON payload using an online JSON validator to catch any syntax errors.

ErikJ
New Contributor III

 

{
    "job_id": ,
    "job_parameters": {
        "params1": "",
        "params2": ""
    }
}

Yes my bad maybe, but it is correctly formatted, and im using POST exactly as described in the databricks rest api documentation. I even copied their example json but that didn't help. I just know that, i can run the job using api, but as soon as i add parameters inside "job_parameters" i get this in return. But I will look into it today! 

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group