cancel
Showing results for 
Search instead for 
Did you mean: 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
cancel
Showing results for 
Search instead for 
Did you mean: 

External Api not returning any response

sshukla
New Contributor III

import requests

url = "https://example.com/api"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
}
Payload = json.dumps({json_data})

response = requests.post(url, headers=headers, data=Payload)

print(response.status_code)
print(response.text)

 

this is running for very long time

Same url is working for other payload 

could you please let me know why this is happening?

 

8 REPLIES 8

Alberto_Umana
Databricks Employee
Databricks Employee

Hello @sshukla,

What is the actual REST API endpoint you are trying to call?

its Kinaxis Api end point.

 

same endpoint is working for other payload but for one specific payload it is not working.

same i have tried in postman and it was giving me result but in databricks it is running for very long 

Alberto_Umana
Databricks Employee
Databricks Employee

Oh I see, it's an external endpoint. Can you test connectivity to the endpoint first? with curl -vX POST https:// endpoint from within Databricks?

Hi,

connectivity is there as i am able to read data for other payload but for one specific payload it is not returning any response

Alberto_Umana
Databricks Employee
Databricks Employee

Can you DIM the two payload, it has to do with something on endpoint, since it is working on one payload fine, where in the other is not to the same endpoint.

guptaharsh
New Contributor II

I have also faced the same issue, where for some payload the API is taking so much time but it is working absolutely fine on postman. Is is some response data size or cluster memory issue?

sshukla
New Contributor III

The issue was due to data size and after filtering the data the issue got resolved

guptaharsh
New Contributor II

how to reduce the data size, like API will going to give the data in onetime. can you give with some example.

res = request.get("api")
this above code is taking is lot of time

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now