APIs & Integrations

scotts1
メンバー

Timeline overview

解決

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 いいね!
1件の承認済みベストアンサー
robertainslie
解決策
HubSpot Employee
HubSpot Employee

Timeline overview

解決

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 いいね!
7件の返信
robertainslie
解決策
HubSpot Employee
HubSpot Employee

Timeline overview

解決

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 いいね!
scotts1
メンバー

Timeline overview

解決

@Robert_Ainslie

Okay that worked, that's frustrating lol

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

0 いいね!
robertainslie
HubSpot Employee
HubSpot Employee

Timeline overview

解決

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 いいね!
scotts1
メンバー

Timeline overview

解決

@Robert_Ainslie that would be amazing, thanks again!

0 いいね!
robertainslie
HubSpot Employee
HubSpot Employee

Timeline overview

解決

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 いいね!
scotts1
メンバー

Timeline overview

解決

@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 いいね!
robertainslie
HubSpot Employee
HubSpot Employee

Timeline overview

解決

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 いいね!