APIs & Integrations

Jam_shakib
Member

Empty response when calling Update email subscription API

Hi everyone

I am trying to make the following call (Update email subscription) to update the subscription status , the call seems to go through and I am getting a successful (HTTP 200) , however the response is empty ( regardless of the email address that I pass ) , is there a way I find out whether the call was successful or not , here is the sample request / response

Thanks,
Jam

------------Request

PUT https://api.hubapi.com/email/public/v1/subscriptions/test@nbfc.com?hapikey=xxx&portalId=xxx HTTP/1.1
User-Agent: Fiddler
Host: api.hubapi.com
Content-Length: 38

{
“unsubscribeFromAll”: true
}

------------Response
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: false
Content-Length: 0
Date: Fri, 29 Jul 2016 19:00:29 GMT
Connection: keep-alive

0 Upvotes
4 Replies 4
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Empty response when calling Update email subscription API

Hi @pkali,

This topic is a couple years old, so it's unlikely that you're running into the exact same issue. It's generally best practice to create a new topic instead of reviving an old one if the topic is older than a few months. That said, are you explicitly including the Content-Type: application/json header?

0 Upvotes
Patryk
Member

Empty response when calling Update email subscription API

Any news on that? I've got the same problem

0 Upvotes
Jam_shakib
Member

Empty response when calling Update email subscription API

Hi Sebastian,

Thanks for your reply , as you can see the response is empty , interesting thing is that when I change the verb to GET and make the call the get the subscription status, as you mentioned I always get the same response ( status = subscribed ) regardless of the email address that I pass ! here is a sample response for jerry2@example.org ( non existent user )

{“subscribed”:true,“markedAsSpam”:false,“portalId”:2267744,“bounced”:false,“email”:“jerry2@example.org”,“subscriptionStatuses”:[],“status”:“subscribed”}

0 Upvotes
seb_fairchild
Member

Empty response when calling Update email subscription API

@Jam.shakib

You should recieve {success:true} in the response body. If you actually want to see the subscription status you’ll need to:

GET /email/public/v1/subscriptions/:email_address

Sebastian

0 Upvotes