Timeline overview


#1

I'm attempting to follow this docs article:

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


#2

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]'


#3

@Robert_Ainslie

Okay that worked, that's frustrating lol

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


#4

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.


#5

@Robert_Ainslie that would be amazing, thanks again!


#6

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.


#7

@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


#8

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