Webhook is truncating reply from OpenWeatherMapAPI

I created a webhook to retrieve data from OpenWeatherAPI. The JSON return value is being truncated to 1571 characters. If I enter the query in my browser, I get the full data set, but the results in the webhook are shown below. Notice the words “(truncated)” at the end of the string.

Is this by design? Is there some way to increase the allowed length of the response?

{“lat”:30.08,“lon”:-94.1,“timezone”:“America/Chicago”,“timezone_offset”:-18000,“current”:{“dt”:1623520378,“sunrise”:1623496479,“sunset”:1623547090,“temp”:89.92,“feels_like”:100.06,“pressure”:1014,“humidity”:61,“dew_point”:74.66,“uvi”:11.04,“clouds”:75,“visibility”:10000,“wind_speed”:3.44,“wind_deg”:270,“weather”:[{“id”:803,“main”:“Clouds”,“description”:“broken clouds”,“icon”:“04d”}]},
“daily”:[{“dt”:1623520800,“sunrise”:1623496479,“sunset”:1623547090,“moonrise”:1623502500,“moonset”:1623555000,“moon_phase”:0.07,“temp”:{“day”:89.92,“min”:74.46,“max”:92.3,“night”:77.36,“eve”:87.01,“morn”:75.52},“feels_like”:{“day”:100.06,“night”:78.69,“eve”:95.23,“morn”:77.05},“pressure”:1014,“humidity”:61,“dew_point”:74.66,“wind_speed”:9.37,“wind_deg”:195,“wind_gust”:19.33,“weather”:[{“id”:803,“main”:“Clouds”,“description”:“broken clouds”,“icon”:“04d”}],“clouds”:75,“pop”:0,“uvi”:11.04},{“dt”:1623607200,“sunrise”:1623582881,“sunset”:1623633512,“moonrise”:1623592200,“moonset”:1623644220,“moon_phase”:0.1,“temp”:{“day”:91.04,“min”:72.75,“max”:91.04,“night”:79.3,“eve”:87.21,“morn”:74.03},“feels_like”:{“day”:99.82,“night”:79.3,“eve”:98.62,“morn”:75.56},“pressure”:1013,“humidity”:56,“dew_point”:73.36,“wind_speed”:7.38,“wind_deg”:281,“wind_gust”:17.29,“weather”:[{“id”:501,“main”:“Rain”,“description”:“moderate rain”,“icon”:“10d”}],“clouds”:85,“pop”:0.93,“rain”:7.6,“uvi”:9.93},{“dt”:1623693600,“sunrise”:1623669285,“sunset”:1623719932,“moonrise”:1623682080,“moonset”:1623733080,“moon_phase”:0.13,“temp”:{“day”:92.97,“min”:73.67,“max”:96.44,“night”:78.98,“eve”:86.41,“morn”:73.96 (truncated)

For longer responses you’d usually you get multiple response events from the webhook each of them with an running number in order to put them back together.

However, if you don’t need all that data on your device you can create a custom response template that will only relay the desired part(s) of the full response.

Hello,

I appreciate you asking this question as I know it may be a bit confusing but you’re right, a limit does exist in the API and if you visit: https://docs.particle.io/reference/device-os/firmware, you can learn more about some of these limits.

That said, please know responses are in byte chunks and you would need to set up the subscription callback to handle multiple chunks (payload splitting) if your responses exceed the permitted capability and likely will from the example you provided.

The good news is, we have a resource you can check out to help, please visit: Webhooks | Reference | Particle as this will be a helpful resource on how to move forward.

Thank you,
Lance Seidman

1 Like

There is also an entire tutorial in the documentation on using the OpenWeather API that may help.

https://docs.particle.io/tutorials/learn-more/weather/

Thank you, guys! This is a great start!

1 Like