APIs & Integrations

吉田成一
Participant

I would like to detect the end of the contact import process.

SOLVE

Hello.

 

I am running the following code in php/sdk

crm()->imports()->coreApi()->create()

Since the import process is executed asynchronously, we are trying to detect the end of the JOB on the PHP side.

If you have a sample implementation, please let me know.

 

Thank you

 

Yoshida

0 Upvotes
2 Accepted solutions
tominal
Solution
Guide | Partner
Guide | Partner

I would like to detect the end of the contact import process.

SOLVE

Hey @吉田成一,

 

I would check out the documentation regarding CRM imports. When you initiate one, it returns an ID. You can then query the API to check the "state" attribute of the import.

 

https://developers.hubspot.com/docs/api/crm/imports

 

tominal_0-1674672503640.png

 

Hope that helps!


Thomas Johnson
Community Champion


Kahu Software LLC
A Texan HubSpot consulting firm
https://kahusoftware.com

View solution in original post

tominal
Solution
Guide | Partner
Guide | Partner

I would like to detect the end of the contact import process.

SOLVE

Hey @吉田成一,

 

I'll tell you what I tell everyone who encounters major confusion with the SDK - I would use your own cURL or Guzzle requests. The PHP SDK has never been intuitive.

 

If you do determine that it is a bug, I would post an issue on the GitHub repository rather than the community forums. Those contributors will be able to help you more than we can.

 

https://github.com/HubSpot/hubspot-api-php

 

Hope that helps!


Thomas Johnson
Community Champion


Kahu Software LLC
A Texan HubSpot consulting firm
https://kahusoftware.com

View solution in original post

0 Upvotes
7 Replies 7
吉田成一
Participant

I would like to detect the end of the contact import process.

SOLVE

I found a bug-like section.

 

$client = Factory::createWithAccessToken(env("HUBSPOT_PRIVATE_APP_TOKEN_IMPORT"));

$resJobCreate = $client->crm()->imports()->coreApi()->create($csvFileObj, json_encode($import_request));

...

$client->crm()->imports()->coreApi()->getById($resJobCreate->getId());

 

Authentication error occurs in getById().

 

I have checked the SDK code.

 

getById() -> getByIdWithHttpInfo() -> getByIdRequest()

 

Within getByIdRequest()

 

        // this endpoint requires API key authentication

        $apiKey = $this->config->getApiKeyWithPrefix('hapikey');

        if ($apiKey ! == null) {

            $queryParams['hapikey'] = $apiKey;

        }

 

The above code retrieves the API key, but does not seem to handle the case where an access token is set.

 

        // this endpoint requires API key authentication

        $apiKey = $this->config->getApiKeyWithPrefix('hapikey');

        if ($apiKey ! == null) {

            $queryParams['hapikey'] = $apiKey;

        }

        // this endpoint requires OAuth (access token)

        if (!empty($this->config->getAccessToken())) {

            $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();

        }

 

I modified the SDK as above and it authenticated.

 

composer.json

 

"hubspot/api-client":"^8.3"

 

Please help me to determine if this is a bug.

0 Upvotes
tominal
Solution
Guide | Partner
Guide | Partner

I would like to detect the end of the contact import process.

SOLVE

Hey @吉田成一,

 

I'll tell you what I tell everyone who encounters major confusion with the SDK - I would use your own cURL or Guzzle requests. The PHP SDK has never been intuitive.

 

If you do determine that it is a bug, I would post an issue on the GitHub repository rather than the community forums. Those contributors will be able to help you more than we can.

 

https://github.com/HubSpot/hubspot-api-php

 

Hope that helps!


Thomas Johnson
Community Champion


Kahu Software LLC
A Texan HubSpot consulting firm
https://kahusoftware.com
0 Upvotes
吉田成一
Participant

I would like to detect the end of the contact import process.

SOLVE

Hey tominal.

 

Thanks for pointing that out.

 

I will report it to the repository.

 

Thank you.

0 Upvotes
tominal
Solution
Guide | Partner
Guide | Partner

I would like to detect the end of the contact import process.

SOLVE

Hey @吉田成一,

 

I would check out the documentation regarding CRM imports. When you initiate one, it returns an ID. You can then query the API to check the "state" attribute of the import.

 

https://developers.hubspot.com/docs/api/crm/imports

 

tominal_0-1674672503640.png

 

Hope that helps!


Thomas Johnson
Community Champion


Kahu Software LLC
A Texan HubSpot consulting firm
https://kahusoftware.com
吉田成一
Participant

I would like to detect the end of the contact import process.

SOLVE

Mr. Johnson.

It was very informative and helpful.

Thank you.

Jaycee_Lewis
Community Manager
Community Manager

I would like to detect the end of the contact import process.

SOLVE

Hi, @吉田成一 👋 Thanks for the question! Hey, @tominal @skimura do you have any tips or a quick example you can share? 

 

Best





loop


Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.

Learn More




0 Upvotes
吉田成一
Participant

I would like to detect the end of the contact import process.

SOLVE

@Jaycee_Lewis

 

Thanks for the support.

0 Upvotes