Timeline overview

SOLVE
New Member

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

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Highlighted
HubSpot Employee

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

Reply
0 Upvotes
7 Replies 7
Highlighted
HubSpot Employee

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

Reply
0 Upvotes
New Member

@Robert_Ainslie

Okay that worked, that's frustrating lol

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

Reply
0 Upvotes
HubSpot Employee

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.

Reply
0 Upvotes
New Member

@Robert_Ainslie that would be amazing, thanks again!

Reply
0 Upvotes
HubSpot Employee

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.

Reply
0 Upvotes
New Member

@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

Reply
0 Upvotes
HubSpot Employee

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

Reply
0 Upvotes