Getting "The response ended prematurely." error from Write.as API

I’ve noticed that in my own web apps, which calls the Write.as api to get posts from my blogs, they’ve stopped working. When I try a local debug, I am getting back a “The response ended prematurely.” error from the Write.as API. However, when I try the same request using Postman, it does return the expected data. So the Write.as api is working fine, but it seems like it is blocking requests from my web apps.

The only major difference is that, I pass in an API Key when making requests from my web apps. This API Key is specific to my write.as account. I’m wondering if the api key has expired and I just need a new one? Or is there some other security rule blocking my requests?

Hmm, the Application Key shouldn’t have expired at all – though individual Access Tokens (returned when logging in via API) do expire.

Are you able to share the response you’re getting back from the API up until that point, including any headers?

Hey Matt, thanks for the clarification.

I am not actually able to get any response back. And so I cannot see any response header values. I even wrote a new console app from scratch and made the call to the write.as api, without having to go through the api/client libary I have, and it still failed with the same error.

However, I think I might have a found a solution to the issue. Somebody on Stack Overflow suggested adding a User-agent request header value, and so I gave it a try, and managed to get a response back from the write.as api. I will test it some more in the coming days and will let you know how it goes.

Finally found time to get this fixed. I can confirm that adding a “user-agent” default header value to my requests allowed the api call to go through.