APIs & Integrations

scotts1
Miembro

Timeline overview

resolver

I'm attempting to follow this docs article:

Timeline API Overview

Overview and Walkthrough for the Timeline API

I followed the pre req and created a dev account and created a new app.

Got the hapi key, user id, and the app id.

Attempt to create an event type and it gives me this error:
{"status":"error","message":"UserId not provided in request", ...

I can't figure out where I'm going wrong since I'm just copying and pasting the command from the article
curl -X POST -H "Content-Type: application/json" -d '
{
"name" : "Example event type",
"applicationId": xxxxx
}'
https://api.hubapi.com/integrations/v1/xxxxx/timeline/event-types?hapikey=xxxxx&userId=xxxx

0 Me gusta
1 Soluciones aceptada
robertainslie
Solución
HubSpot Employee
HubSpot Employee

Timeline overview

resolver

Hi @scotts

Try wrapping your URL in single quotes, so the command becomes like this:

curl -X POST -H "Content-Type: application/json" -d '{"name" : "Billing", "applicationId": [app-id]}' 'https://api.hubapi.com/integrations/v1/[app-id]/timeline/event-types?hapikey=[hapi]&userId=[userId]'

Ver la solución en mensaje original publicado

0 Me gusta
7 Respuestas 7
robertainslie
Solución
HubSpot Employee
HubSpot Employee

Timeline overview

resolver

Hi @scotts

Try wrapping your URL in single quotes, so the command becomes like this:

curl -X POST -H "Content-Type: application/json" -d '{"name" : "Billing", "applicationId": [app-id]}' 'https://api.hubapi.com/integrations/v1/[app-id]/timeline/event-types?hapikey=[hapi]&userId=[userId]'

0 Me gusta
scotts1
Miembro

Timeline overview

resolver

@Robert_Ainslie

Okay that worked, that's frustrating lol

Any particular reason why I had to wrap it in single quotes?

0 Me gusta
robertainslie
HubSpot Employee
HubSpot Employee

Timeline overview

resolver

Glad that worked!

I'm not a curl expert, but I think it's because the URL has parameters - if params are present, you have to treat the URL as a string. I'll follow up with the keeper of the docs to see if we can alter the example curl request to avoid future confusion.

0 Me gusta
scotts1
Miembro

Timeline overview

resolver

@Robert_Ainslie that would be amazing, thanks again!

0 Me gusta
robertainslie
HubSpot Employee
HubSpot Employee

Timeline overview

resolver

Found the reason - it depends on the type of console you're using. Bash tries to turn ? and & into commands. So, on some terminals quotes aren't required, but they are in others.

I had the doc updated still, but, that's the reason.

0 Me gusta
scotts1
Miembro

Timeline overview

resolver

@Robert_Ainslie Off topic to the original question but in the same timeline API docs.

The second step "2. Defining Event Properties" both curl commands require the application id to be in the request data.

curl -X POST -H "Content-Type: application/json" -d '
{
"name" : "webinarName",
"label" : "Webinar Name",
"propertyType": "String"
}'
'https://api.hubapi.com/integrations/v1/</timeline/event-types/<>/properties?hapikey=<>&userId=<>'

Needed to be

curl -X POST -H "Content-Type: application/json" -d '
{
"name" : "webinarName",
"label" : "Webinar Name",
"propertyType": "String",
"applicationId": <>

}'
'https://api.hubapi.com/integrations/v1/</timeline/event-types/<>/properties?hapikey=<>&userId=<>'

Before it would work correctly

0 Me gusta
robertainslie
HubSpot Employee
HubSpot Employee

Timeline overview

resolver

Thanks for the heads up and can pass along as well.

The overview example should definitely include that, but my general recommendation is to view the specific doc for each of these calls, which includes more exhaustive detail. In this case, this one: https://developers.hubspot.com/docs/methods/timeline/create-event-type and this one: https://developers.hubspot.com/docs/methods/timeline/create-timeline-event-type-property

0 Me gusta