Unexpected API response

SOLVE
Highlighted
New Contributor

Hi Team,

 

My goal here is to retrieve the values Deal Name, Amount, Closed Date ,Stage , Pipeline for a specific Deal. Im using get a deal endpoint to do so.

However get a Deal API Output shows encoded or indexed value.

Expected Output = G Suite
The Output  that I got =  1129c87a-a92b-472d-a9bb-604692e5d2ea
 
Below are the screenshots that can be used to understand the issue.  
 
jsonDatafromGetDealApi.pnghbScreenshot.png
 
Any help is appreciated.
Regards,
Komal
Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
HubSpot Employee

Hi @KB496,

 

HubSpot API endpoints accept UNIX formatted timestamps in milliseconds. Using any of the HubSpot endpoints to extract information relating to dates will return milliseconds. There is more information on this here.

 

To clarify further, if I have a deal with a "Closed Date" = 09/01/2020 I would make a GET request using the "Get a deal" endpoint. The response body would contain the following, the bold text is the millisecond timestamp representing the date 09/01/2020.

 

"closedate": {
            "value": "1578584645680",
            "timestamp": 1578584647878,
            "source": "CRM_UI",
            "sourceId": "jackcoldrick@hubspot.com",
            "versions": [
                {
                    "name": "closedate",
                    "value": "1578584645680",
                    "timestamp": 1578584647878,
                    "sourceId": "jackcoldrick@hubspot.com",
                    "source": "CRM_UI",
                    "sourceVid": []
                }
            ]
        }

 

I could then use the "value" and convert into the appropriate date format. There are many different ways to convert UNIX millisecond timestamps to readable dates. One example would be using Javascript:

 

var milliseconds = 1578584645680;
var readableDate = new Date(milliseconds);
console.log(readableDate)

The output of the above would be "Thu Jan 09 2020 15:44:05 GMT+0000 (Greenwich Mean Time)".

 

Regards,

Jack

Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn
3 Replies 3
HubSpot Employee

Hi @KB496,

 

This is expected behaviour. What is being returned to you is the internal ID of the deal pipeline. You can use the ID returned to pull the pipeline name using the "Get Deal Pipeline" endpoint.

 

I hope this helps,

Jack

Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn
New Contributor

Hi Jack,

 

Thankyou for responding.

I would also want to bring to your notice that while I extract "Closed date" the output returned for this is an alphanumeric string however the expected value here is "dd-mm-yyyy". 

 

Can you please look into this and revert back at earliest.

 

Thanks,

Komal

 

Reply
0 Upvotes
HubSpot Employee

Hi @KB496,

 

HubSpot API endpoints accept UNIX formatted timestamps in milliseconds. Using any of the HubSpot endpoints to extract information relating to dates will return milliseconds. There is more information on this here.

 

To clarify further, if I have a deal with a "Closed Date" = 09/01/2020 I would make a GET request using the "Get a deal" endpoint. The response body would contain the following, the bold text is the millisecond timestamp representing the date 09/01/2020.

 

"closedate": {
            "value": "1578584645680",
            "timestamp": 1578584647878,
            "source": "CRM_UI",
            "sourceId": "jackcoldrick@hubspot.com",
            "versions": [
                {
                    "name": "closedate",
                    "value": "1578584645680",
                    "timestamp": 1578584647878,
                    "sourceId": "jackcoldrick@hubspot.com",
                    "source": "CRM_UI",
                    "sourceVid": []
                }
            ]
        }

 

I could then use the "value" and convert into the appropriate date format. There are many different ways to convert UNIX millisecond timestamps to readable dates. One example would be using Javascript:

 

var milliseconds = 1578584645680;
var readableDate = new Date(milliseconds);
console.log(readableDate)

The output of the above would be "Thu Jan 09 2020 15:44:05 GMT+0000 (Greenwich Mean Time)".

 

Regards,

Jack

Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn