APIs & Integrations

MishimaKuniki
Contributor

Companies API Create

POST/crm/v3/objects/companies

についてなのですが、

こちらのパラメータで、会社名、電話番号、会社の担当者、市区町村、都道府県

郵便番号をそれぞれ会社作成時に追加したいのですが、パラメータの指定方法をご教授いただけないでしょうか?

 

入力パラメータがこちら↓

{
"property_number": "344",
"property_dropdown": "choice_c",
"property_radio": "option_20",
"property_string": "value",
"property_multiple_checkboxes": "noujou",
"property_checkbox": "false",
"property_date": "298929830000",
"property_name": "ほげほげ農園"
}

 

返ってきたエラー文がこちらになります↓

HTTP 400

{
"status": "error",
"message": "Property values were not valid: [{\"isValid\":false,\"message\":\"Property \\\"property_number\\\" does not exist\",\"error\":\"PROPERTY_DOESNT_EXIST\",\"name\":\"property_number\"},{\"isValid\":false,\"message\":\"Property \\\"property_dropdown\\\" does not exist\",\"error\":\"PROPERTY_DOESNT_EXIST\",\"name\":\"property_dropdown\"},{\"isValid\":false,\"message\":\"Property \\\"property_radio\\\" does not exist\",\"error\":\"PROPERTY_DOESNT_EXIST\",\"name\":\"property_radio\"},{\"isValid\":false,\"message\":\"Property \\\"property_string\\\" does not exist\",\"error\":\"PROPERTY_DOESNT_EXIST\",\"name\":\"property_string\"},{\"isValid\":false,\"message\":\"Property \\\"property_multiple_checkboxes\\\" does not exist\",\"error\":\"PROPERTY_DOESNT_EXIST\",\"name\":\"property_multiple_checkboxes\"},{\"isValid\":false,\"message\":\"Property \\\"property_checkbox\\\" does not exist\",\"error\":\"PROPERTY_DOESNT_EXIST\",\"name\":\"property_checkbox\"},{\"isValid\":false,\"message\":\"Property \\\"property_date\\\" does not exist\",\"error\":\"PROPERTY_DOESNT_EXIST\",\"name\":\"property_date\"},{\"isValid\":false,\"message\":\"Property \\\"property_name\\\" does not exist\",\"error\":\"PROPERTY_DOESNT_EXIST\",\"name\":\"property_name\"}]",
"correlationId": "4f698606-5fcf-4226-88cd-692d97d377ff",
"category": "VALIDATION_ERROR"
}

 

またサポートの方から以前作成したものと重複しているのでは?

とのご指摘を頂いたので、修正後エラーが直りませんでした。

どうぞよろしくお願いいたします。

 

0 Upvotes
5 Replies 5
dennisedson
HubSpot Product Team
HubSpot Product Team

Companies API Create

hi @MishimaKuniki ,

First of all, Let me say how excited I am to see a Japanese developer asking questions here!  

To use this API, you will need to make sure that the properties already exist in your HubSpot portal.  

Based on your question, you want to collect the following

  • Company Name
  • Phone Number
  • Company Person in charge
  • City,
  • Prefecture

In your HubSpot portal settings, you can click on properties and then filter by company properties.  This will display all of the properties that can be associated with a company.  Clicking on any of the available properties will pull up a sidebar titled "Edit property".  Here you will also see this  </>.  Clicking on this will give you access to the internal name which is what you will use in your API post payload.  

As a quick example, I have clicked on the name property and as you can see in this screenshot, the internal name is also "name"   

Property_settings.png

If all I wanted to do was create a company and only populate the name, this would be my json: 

{
  "properties": {
    "name": "Test"
  }
}

For your specific request, you would want to verify the properties in your portal and then add to that json body.  Remember, if the property does not exist in your portal, your API request will fail.  

 

Hope this guides you in the correct direction!  

 

@natsumimori , will be a helpful resource if you need any translation!

 

Best,

 

MishimaKuniki
Contributor

Companies API Create

@dennisedson さん

 

回答ありがとうございます!

確認し、また何か問題が発生しましたら質問させていただきますので、

よろしくお願いいたします!

0 Upvotes
natsumimori
Community Manager
Community Manager

Companies API Create

@MishimaKuniki さん

 

お役に立てたようで幸いです😊また疑問が出てきましたらDeveloper's Forumまたは日本語版HubSpotコミュニティーをご利用ください♪

 

@dennisedson He is all set for now and will come back if he has future questions:) He appreciates your help!

0 Upvotes
natsumimori
Community Manager
Community Manager

Companies API Create

@MishimaKuniki さん

 

こんにちは、日本語版HubSpotコミュニティーマネージャーの森です。

ディベロッパーフォーラムマネージャーの @dennisedson から返答があったようですが、上記の返答で問題は解決しそうでしょうか?

 

返答の要約:

このAPIを使用するには、JSONで指定しているプロパティーが全てHubSpotアカウントに存在している必要があります。まずは、会社名、電話番号、会社の担当者、市区町村、都道府県、郵便番号プロパティーがアカウントに既存かどうか確かめてみてください。

その確認ができたら、内部値をJSONに入力します。例えば新しく会社を作り、会社名(name)だけを入れたい場合には、次のようなJSONになります。

{
  "properties": {
    "name": "Test"
  }
}

 

よろしくお願いします。

MishimaKuniki
Contributor

Companies API Create

@natsumimori さん

 

翻訳ありがとうございます!

上記の内容で解決しそうです!

ありがとうございました!

 

引き続き、上記の内容で確認し何か問題が発生しましたらまた質問させていただきます!

0 Upvotes