APIs & Integrations

SDijkstra
Member

API error on creating Ticket

SOLVE

Hi,

 

I am using the PHP API and I am trying to create a new ticket with the API, but I am getting the following error. 

Exception when calling basic_api->create: [400] Client error: `POST https://api.hubapi.com/crm/v3/objects/tickets?hapikey=XXX` resulted in a `400 Bad Request` response: {"status":"error","message":"Error creating TICKET. Some required properties were not set.","correlationId":"a0136598-f (truncated...)

 

I am using the documentation:

https://developers.hubspot.com/docs/api/crm/tickets#anchor-post-/crm/v3/objects/tickets

 

I remove the API-key, but the API connection is valid, but I am getting the error above when I am trying to add a ticket. 

 

I am trying to use this properties: 

$properties = [
"hs_pipeline" => "support_pipeline",
"hs_pipeline_stage" => "open",
"hs_ticket_priority" => "HIGH",
"hubspot_owner_id" => "",
"subject" => "Example Ticket",
"content" => "I am creating a new ticket"
];
$SimplePublicObjectInput = new SimplePublicObjectInput(['properties' => $properties]);

 

Is there somethin I am missing, because I've copy pasted the code from the documentation but still getting an error.

 

Hope somebody van help me, thanks in advance!

0 Upvotes
1 Accepted solution
himanshurauthan
Solution
Thought Leader | Elite Partner
Thought Leader | Elite Partner

API error on creating Ticket

SOLVE

Hello @SDijkstra,

 

I tried using the API docs interface and ticket created on my portal and I used the following parameter:

 

$properties = [

  "hs_pipeline" => "0",

  "hs_pipeline_stage" => "1",

  "hs_ticket_priority" => "HIGH",

  "hubspot_owner_id" => "",

  "subject" => "Example Ticket",

  "content" => "I am creating a new ticket"

];

 

I changed the hs_pipeline code instead of the hs_pipeline name.

 

Please change the hs_pipeline and hs_pipeline_stage with their codes instead of their name.

 

Regards,

Digital Marketing & Inbound Expert In Growth Hacking Technology

View solution in original post

0 Upvotes
10 Replies 10
himanshurauthan
Solution
Thought Leader | Elite Partner
Thought Leader | Elite Partner

API error on creating Ticket

SOLVE

Hello @SDijkstra,

 

I tried using the API docs interface and ticket created on my portal and I used the following parameter:

 

$properties = [

  "hs_pipeline" => "0",

  "hs_pipeline_stage" => "1",

  "hs_ticket_priority" => "HIGH",

  "hubspot_owner_id" => "",

  "subject" => "Example Ticket",

  "content" => "I am creating a new ticket"

];

 

I changed the hs_pipeline code instead of the hs_pipeline name.

 

Please change the hs_pipeline and hs_pipeline_stage with their codes instead of their name.

 

Regards,

Digital Marketing & Inbound Expert In Growth Hacking Technology
0 Upvotes
DdeGraaf
Member

API error on creating Ticket

SOLVE

I just tried a plain CURL request with the same full body and it fires correctly and creates the ticket.

Something in the library/dependencies/configuration/versioning seems to be creating the empty body. 

Since both me and my collegue have the same exact issue would suggest there is a broader problem than just a single configuration right? We have tried it from atleast 3 machines and a server. All same issue.

0 Upvotes
DdeGraaf
Member

API error on creating Ticket

SOLVE

Thanks  @himanshurauthan & @RMones !
I have implemented all parameters to the following result:

 

https://pastebin.com/Ti2TAt0W 

 

Nevertheless the error doesn't change.

When I look at the received request somehow the body seems empty, I tried using the api docs interface with our API and that does create the body. Can dependencies/phpversions etc. be blocking the actual sending of the content body?

 

 

lfCoCd3

VS

lfCoCd3

FLXRD6w[1].png

Hoping to get some insights, will try and send a clean CURL with all the parameters as well to verify this might be the issue.

 

0 Upvotes
SDijkstra
Member

API error on creating Ticket

SOLVE

Hi both,

 

Thanks voor your replies, a colleague of mine is working on it further. I will pass on your tips!

0 Upvotes
himanshurauthan
Thought Leader | Elite Partner
Thought Leader | Elite Partner

API error on creating Ticket

SOLVE

Hello @SDijkstra,

 

I have checked and found that the properties values that you are sending are not correct. Please send the id of the pipeline and pipeline stage instead name.

 

$properties = [

  "hs_pipeline" => "0",

  "hs_pipeline_stage" => "1",

  "hs_ticket_priority" => "HIGH",

  "hubspot_owner_id" => "",

  "subject" => "Example Ticket",

  "content" => "I am creating a new ticket"

];

 

I have tested with the above array and got the 201 success code.

 

Regards,

Digital Marketing & Inbound Expert In Growth Hacking Technology
0 Upvotes
RMones
Contributor | Platinum Partner
Contributor | Platinum Partner

API error on creating Ticket

SOLVE

Hi @SDijkstra ,

 

When I tried it with Postman I've an error that the hs_pipeline_stage is not valid.

I changed the payload a bit, and now it's working for me:

$properties = [
    "hs_pipeline" => "0",
    "hs_pipeline_stage" => "1",
    "hs_ticket_priority" => "HIGH",
    "hubspot_owner_id" => "",
    "subject" => "Example Ticket",
    "content" => "I am creating a new ticket" 
];

I tink Hubspot is expecting a pipeline ID and and Pipeline Stage ID

 

Regards Ronald

SDijkstra
Member

API error on creating Ticket

SOLVE

Hi TiphaineCuisset,

 

Thanks for that! I can add some additional information, which I am seeing in the Hubspot account.

 

HEADER:

User-Agent: hubspot-api-client-php; 4.0.0
CDN-Loop: cloudflare; subreqs=1
Accept-Encoding: gzip
CF-Connecting-IP: 2a03:9700:8000:0:eea5:488:e1b0:3e89
True-Client-IP: 2a03:9700:8000:0:eea5:488:e1b0:3e89
X-HubSpot-Trace: 32d4e945fa005303f90bab821fe430bc
X-HubSpot-Correlation-Id: f3c497e6-f545-42ae-b143-0f665a97fa7b
X-HS-Internal-Request: 1
Content-Length: 2
X-Real-IP: 2a03:9700:8000:0:eea5:488:e1b0:3e89
Content-Type: application/json
cf-worker: hubapi.com
CF-IPCountry: NL
CF-RAY: 6b65160a543e1e9d-EWR
Accept: application/json
X-Forwarded-Proto: https
Connection: close
X-Request-Start: 1638285902.527
X-HS-Internal-User-Request: 0
Host: api.hubapi.com
CF-Visitor: {"scheme":"https"}
X-HS-User-Request: 0
CF-EW-Via: 15
X-Forwarded-Port: 443
X-Amzn-Trace-Id: Root=1-61a6424e-3c36ab055f89bb9d53299ecf
X-Forwarded-For: 2a03:9700:8000:0:eea5:488:e1b0:3e89, 172.70.114.52, 2a03:9700:8000:0:eea5:488:e1b0:3e89
X-Scheme: https

 

X-HubSpot-RateLimit-Remaining: 96
X-HubSpot-RateLimit-Max: 100
X-HubSpot-RateLimit-Daily: 250000
X-HubSpot-RateLimit-Daily-Remaining: 249903
X-HubSpot-RateLimit-Interval-Milliseconds: 10000
X-HubSpot-RateLimit-Secondly: 10
X-HubSpot-RateLimit-Secondly-Remaining: 9
Content-Type: {"type":"application","subtype":"json","parameters":{"charset":"UTF-8"},"wildcardType":false,"wildcardSubtype":false}

 

TEXT:

{
"status": "error",
"message": "Error creating TICKET. Some required properties were not set.",
"correlationId": "f3c497e6-f545-42ae-b143-0f665a97fa7b",
"context": {
"properties": [
"hs_pipeline_stage"
]
},
"category": "VALIDATION_ERROR"
}

 

RESPONSE:

0 Upvotes
TiphaineCuisset
Community Manager
Community Manager

API error on creating Ticket

SOLVE

Hi @SDijkstra 

 

Thank you for reaching out.

 

I want to tag some of our experts on this - @himanshurauthan @miljkovicmisa do you know what could be happening here? 

 

Thank you!

Best

Tiphaine


Saviez vous que la Communauté est disponible en français?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !


theferrett
Participant

API error on creating Ticket

SOLVE

The answers given above are incorrect.  The problem is that the SDK's sanitization routine is bugged so it's stripping the request of all its POST fields before it sends the create request, meaning the SDK cannot be used to create a ticket at this time. 

 

I've posted an issue to their GitHub; we'll see if they can fix it soon.   

0 Upvotes
FRenteria
Member

API error on creating Ticket

SOLVE

Hi!
I woudl like to know if you were able to solve this issue..

I'm having the same problem and I haven't the solution. 

Could you help me with this?  I will appreciate it. 

 

Thanks

0 Upvotes