Problem access to api crm-associations

SOLVE
Occasional Contributor

Hi,

When try to access https://api.hubapi.com/crm-associations/v1/associations?hapikey=demo. It shows me the mistake
HTTP ERROR 405

Problem accessing /crm-associations/v1/associations. Reason:

Method Not Allowed

Kind Regards

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Solution
Occasional Contributor

Hi Itakushi,

The problem has been solved. The call had to be made with the put method and not with post.

Thanks for you colaboration

Kind Regards

View solution in original post

9 Replies 9
HubSpot Employee

Hi @CTO-BB,

If you are attempting to associate CRM objects, please ensure you are using the PUT method.

Isaac Takushi

Alumnus, HubSpot Developer Support
Reply
0 Upvotes
Occasional Contributor

Hi Itakushi.

I Have been still the steps that the post indicates and is still me appearing the mistake

Kind Regards.

Reply
0 Upvotes
HubSpot Employee

Hi @CTO-BB,

Please copy the text or a screenshot of your request below so that I can investigate. If you are using the correct method (GET, PUT, or POST), you should not receive a 405 Method Not Allowed error.

Isaac Takushi

Alumnus, HubSpot Developer Support
Reply
0 Upvotes
Occasional Contributor

Hi!

Weŕe mainly interested in creating a conversation or ticket through the API. From what weve seen the ticket section doesnt allow to associate tickets with contacts.

CAn you please give us support on this matter and let us know how to proceed to create a conversation?

Many thanks

Reply
0 Upvotes
HubSpot Employee

Thank you for the clarification, @CTO-BB.

At this time, the Tickets API can't create associations with contacts, but the CRM Associations API can.

For example, this endpoint can associate a ticket to a contact with "definitionId": 15 if both object IDs are included.

Isaac Takushi

Alumnus, HubSpot Developer Support
Reply
0 Upvotes
Occasional Contributor

Hello, good morning:

I followed the manual and the error continues to appear. Apart from this I have tried to update a company following the manual https://developers.hubspot.com/docs/methods/companies/update_company
And I get error 405 just like in the previous case. I copy the example

arr = array(
properties' => array(
array
name' => 'description modified',
value' => 'hubspot'.
)
)
);
$post_json = json_encode($arr);
//$hapikey = readline("Enter hapikey: (demo for the demo portal): ");
endpoint = 'https://api.hubapi.com/companies/v2/companies/922536531?hapikey=XXXXXXXXXXXXXXXX';
$ch = @curl_init();
@curl_setopt($ch, CURLOPT_POST, true);
@curl_setopt($ch, CURLOPT_POSTFIELDS, $post_json);
@curl_setopt($ch, CURLOPT_URL, $endpoint);
@curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
response = @curl_exec($ch);
Status_code = @curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curl_errors = curl_error($ch);
@curl_close($ch);
echo "curl Errors: " . $curl_errors;
echo "\nStatus code: " . $status_code;
echo "Reply: " . $response;

Kind Regards

Reply
0 Upvotes
Occasional Contributor

Any updates on the required request?

Reply
0 Upvotes
HubSpot Employee

Hi @CTO-BB,

To update a company, you must use PUT. In that cURL code, you are using POST, which is why 405 Method Not Allowed is returned.

Isaac Takushi

Alumnus, HubSpot Developer Support
Reply
0 Upvotes
Solution
Occasional Contributor

Hi Itakushi,

The problem has been solved. The call had to be made with the put method and not with post.

Thanks for you colaboration

Kind Regards

View solution in original post