Response deserialization error

I am attempting to display a card under contacts using the CRM Extensions API. I have the portal communicating with the service and it is returning data. However, I’m getting the error message in the card that I’ve seen in other posts and the “Response deserialization error” when looking at it in the monitor. I’ve looked at the other related posts and the two solutions that I saw (case sensitive objectId and null values) don’t appear to be my issue. If I copy the request and put it into Postman, I get the following JSON back:

{
 "results": [
 {
 "objectId": 6791646,
 "quoteDate": 1551830400000,
 "quoteLink": {
 "value": "https://brokerquotes.mycompany.com/api/quote/6791646",
 "linkLabel": "03/06/2019"
 },
 "totalPremium": {
 "value": 5772.88,
 "currencyCode": "USD"
 }
 },
 {
 "objectId": 6791730,
 "quoteDate": 1551830400000,
 "quoteLink": {
 "value": "https://brokerquotes.mycompany.com/api/quote/6791730",
 "linkLabel": "03/06/2019"
 },
 "totalPremium": {
 "value": 50813.72,
 "currencyCode": "USD"
 }
 },
 {
 "objectId": 6791060,
 "quoteDate": 1551830400000,
 "quoteLink": {
 "value": "https://brokerquotes.mycompany.com/api/quote/6791060",
 "linkLabel": "03/06/2019"
 },
 "totalPremium": {
 "value": 5358.78,
 "currencyCode": "USD"
 }
 },
 {
 "objectId": 6791709,
 "quoteDate": 1551830400000,
 "quoteLink": {
 "value": "https://brokerquotes.mycompany.com/api/quote/6791709",
 "linkLabel": "03/06/2019"
 },
 "totalPremium": {
 "value": 50813.72,
 "currencyCode": "USD"
 }
 },
 {
 "objectId": 6791773,
 "quoteDate": 1551830400000,
 "quoteLink": {
 "value": "https://brokerquotes.mycompany.com/api/quote/6791773",
 "linkLabel": "03/06/2019"
 },
 "totalPremium": {
 "value": 50813.72,
 "currencyCode": "USD"
 }
 }
 ]
}

I’ve entered the JSON into a JSON validator and it says that it is correct. Any help would be greatly appreciated as I’ve spent the better part of the day trying to figure it out.

Hi @Matthe_McKinney , that’s a bit strange. Just so we’re on the same page, can you confirm your app ID is 189533? If so, when I use your CRM extensions url, I’m not able to get to that URL. Can you confirm that’s still working? You should also be including your URL in the base urls section of your app.

Thanks @cbarley. I was trying different things late Friday and must have gotten the server into an odd state. I noticed this morning that Postman was still retrieving proper results, but looking at the logs on the server, a 400 was being returned to HubSpot. I put the server back to a proper state so that a 200 is being returned to HubSpot. I’m not getting the response deserialization error, but the display is empty. I copied my “Data Fetch URI” to the “Base URI” section like you mentioned (that was unclear in the documentation or UI, sounded like it was optional), but nothing changed.

I still get valid data back from Postman (although I’m not as confident in that now). My app ID is 189533, can you try again and see if you can get to the URL? Is there a way to see what the response is from my server?

Thanks!

Hi @Matthe_McKinney , I’m still getting a 400 in both Postman and in the browser.

@cbarley , I am validating the X-HubSpot-Signature header value and I don’t see that showing up in your requests. Do I need to disable that for you to look into this (alternatively, I’ve provided the value below)?

Is there a way for you to view the contents of the response that I see in the App Monitor? The last three I have sent from the test portal show a green dot and a HTTP 200 code. If you want to attempt one of those GET requests in Postman, you can use the value 1e55af7d92d71c9b23c4474913f7cc64606ce5ea4403891b676459fcf4005457 for the X-HubSpot-Signature header value.

Ah, thanks @Matthe_McKinney , I didn’t realize you were using request signatures. let me take a look

Hi @Matthe_McKinney , a couple things to suggest after testing this out:

  1. When I make a GET with this URL https://brokerquotes.copower.com/api/HubSpot?userId=7150500&userEmail=mmckinney@copower.com&associatedObjectId=101&associatedObjectType=CONTACT&portalId=5516779&email=michelle.navickas@hubinternational.com and the valid HubSpot Signature, I can see that all of your properties start with an uppercased letter:

    1. This will not work. You’ll need to have these camelcased i.e. “results”, “totalPremium”, “value”, “currencyCode” etc.
  2. When I use the following body, in my app, the correct info gets populated:

    1.  {
        "results": [
        {
        "objectId": 6791646,
        "title": "Test Objects",
        "quoteDate": "2019-03-11",
        "quoteLink": {
        "value": "https://obscure-cliffs-47038.herokuapp.com/iframe",
        "linkLabel": "Link to iFrame"
        },
        "totalPremium": {
        "value": 5772.88,
        "currencyCode": "USD"
        }
        }
        ]
       }
      

      You can see this here:

  3. Your Date field is currently formatted as a millisecond timestamp. You should follow the “Date Properties” section here and format it as “yyyy-mm-dd”. Otherwise, if you need to use specific times that are not midnight UTC, you should change this date field inside your Developer Account to a datetime field.

Let me know if you have questions

Thanks @cbarley for the suggestions. Apologies for the casing, I had it camelCase at one point but messing around with it I must have changed something and it went back to starting with an upper case letter.

I made the change to the date and re-tried but it still didn’t work. I did notice though that you had a “title” in your example. I added that in to try that and now it works! I had thought that was optional but I guess not!

Thanks for your help, these look really good in the contact view!

@Matthe_McKinney great news! I didn’t see any mention of it being required, but I suppose there’s no reason you wouldn’t want that to be populated so it makes sense. We’re revamping our docs over the next year, so I think we’ll be redoing a lot of the docs like this one.

People on my team have wasted two engineering days trying to figure out why their sane endpoint response was throwing deserialization errors and it was because of the missing title property.

Y’all need to highlight that in the documentation and/or improve the error messages that you throw. Should be straightforward to add a more descriptive missing parameters error message.

I suddenly started getting this error too, and still haven’t figured it out. I haven’t changed a thing in code but this just suddenly started happening yesterday. It’s very frustrating not to have any clue why HS is having a problem with my json.

I created a new post here a few hours ago. Hopefully I can get it resolved and have another “fix” for this at this location. I’m assuming that I did something 3 years ago that wasn’t “legal” but didn’t prevent the integration from working at the time.

But a giant +1 for better error messages please :(((