SimplePublicObjectInputForCreate does not exist, probably wrong documentation?

Here is the code example I found in in Accounts Dashboard | HubSpot, the Create section:

import hubspot
from pprint import pprint
from hubspot.crm.tickets import SimplePublicObjectInputForCreate, ApiException

client = hubspot.Client.create(access_token="YOUR_ACCESS_TOKEN")

properties = {
 "hs_pipeline": "support_pipeline",
 "hs_pipeline_stage": "open",
 "hs_ticket_priority": "HIGH",
 "hubspot_owner_id": "910901",
 "subject": "troubleshoot report"
}
simple_public_object_input_for_create = SimplePublicObjectInputForCreate(properties=properties, associations=[{"to":{"id":"101"},"types":[{"associationCategory":"HUBSPOT_DEFINED","associationTypeId":2}]}])
try:
 api_response = client.crm.tickets.basic_api.create(simple_public_object_input_for_create=simple_public_object_input_for_create)
 pprint(api_response)
except ApiException as e:
 print("Exception when calling basic_api->create: %s\n" % e)

When I do the same thing in my IDE (PyCharm), I got

Cannot find reference 'SimplePublicObjectInputForCreate' in '__init__.py'

So I tried to find this class in source code: hubspot-api-python/hubspot/crm/tickets/models at master · HubSpot/hubspot-api-python · GitHub , but no luck.
Is the documentation wrong or outdated? thanks

Hello @KKang5

It appears that the ‘SimplePublicObjectInputForCreate’ class is no longer available in the current version of the HubSpot API Python client library. The documentation you are referring to might be outdated or incorrect.

Instead, you can use the ‘PublicTicketCreateRequest’ class for creating new tickets.
Here’s an example

import hubspot
from pprint import pprint
from hubspot.crm.tickets import PublicTicketCreateRequest, ApiException

client = hubspot.Client.create(access_token="YOUR_ACCESS_TOKEN")

ticket_properties = {
 "subject": "troubleshoot report",
 "content": "Please help me troubleshoot this issue.",
 "hs_pipeline": "support_pipeline",
 "hs_pipeline_stage": "open",
 "hs_ticket_priority": "HIGH",
 "hubspot_owner_id": "910901"
}
ticket_create_request = PublicTicketCreateRequest(**ticket_properties)

try:
 api_response = client.crm.tickets.basic_api.create(ticket_create_request)
 pprint(api_response)
except ApiException as e:
 print("Exception when calling basic_api->create: %s\n" % e)

You can find more information about the ‘PublicTicketCreateRequest’ class and its properties in the official HubSpot API documentation:
Accounts Dashboard | HubSpot.
Thanks & Regards
Himanshu Rauthan

@himanshurauthan There is no PublicTicketCreateRequest in the codebase, nor the docs.
You can see there is no import in https://github.com/HubSpot/hubspot-api-python/blob/master/hubspot/crm/tickets/__init__.py
I would also like to know if the offical docs are outdated, if yes someone please update them

Hello ! Same issue for contact creation, on this doc page : Accounts Dashboard | HubSpot

> SimplePublicObjectInputForCreate not found

And by the way for your previous answer about tickets object :

Figured out you have to keep off ForCreate :roll_eyes:
Do you have the library for the PHP version?

<?php
// Starting November 30, 2022, API keys will be sunset as an authentication method. Learn more about this change: Upcoming: API Key Sunset and how to migrate an API key integration: Developer platform - HubSpot docs to use a private app instead.
use HubSpot\Factory;
use HubSpot\Client\Crm\Contacts\ApiException;
use HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectInputForCreate;
use HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInputForCreate;

$client = Factory::createWithAccessToken(‘YOUR_ACCESS_TOKEN’);

$properties1 = [
‘company’ => ‘Biglytics’,
‘email’ => ‘bcooper@biglytics.net’,
‘firstname’ => ‘Bryan’,
‘lastname’ => ‘Cooper’,
‘phone’ => ‘(877) 929-0687’,
‘website’ => ‘biglytics.net’
];
$simplePublicObjectInputForCreate1 = new SimplePublicObjectInputForCreate([
‘properties’ => $properties1
]);
$batchInputSimplePublicObjectInputForCreate = new BatchInputSimplePublicObjectInputForCreate([
‘inputs’ => [$simplePublicObjectInputForCreate1],
]);
try {
$apiResponse = $client->crm()->contacts()->batchApi()->create($batchInputSimplePublicObjectInputForCreate);
var_dump($apiResponse);
} catch (ApiException $e) {
echo "Exception when calling batch_api->create: ", $e->getMessage();
}
CRM API | Contacts (hubspot.com)

@Jaycee_Lewis sorry for ping you in, but is there any solution for this? or at least update the documentation

@KKang5 I had the support, for them the documentation is up to date (lol).

But they gave me a working solution, use “SimplePublicObjectInput” instead of "

SimplePublicObjectInputForCreate"

Best regards