How to access the Products API to create products


#41

Hi @Isaac_Takushi or @Derek_Gervais,

Could you grant the trial as well to portal 4979230?
I've also hit the "Must have scope INBOUNDDB_PRODUCT_LIBRARY_WRITE" error mentioned in this topic.


#42

Hi @yhdev,

You should be all set. I've granted test portal 4979230 60 days of access to Sales Pro.


#43

@Isaac_Takushi @Derek_Gervais,

Could one of you kindly grant Sales Pro access to the following portal:

4829116

Thanks!!


#44

I've granted test portal 4829116 60 days of access to Sales Pro, @tini5000. Let me know if there are any issues accessing the tools.


#45

@Isaac_Takushi I am putting a HubSpot integration spec to together for client which is due today! Sorry for the late notice. I did not expect to run into this issue. Can I get access to the products API as well? Test Portal ID 5068168.
Thank you!


#46

You should be all set, @FoolishWiseman! I've granted test portal 5068168 60 days of access to Sales Pro.


#47

Thank you @Isaac_Takushi for the super fast response!
It wasn't working at first, but I just had to request a new access token, and the API requests are working. So that is great!

Should this take affect in the UI side of things as well? I see the update:

But under deals, "Add Products" still shows a lock and is prompting me to upgrade:


#48

@FoolishWiseman,

I would expect you to be able to access the Sales Hub Professional tools in the UI, but I've been able to replicate this behavior myself. I've reached out to the team for more insight, however you should have no issues with API calls.


#49

@Isaac_Takushi @Derek_Gervais
I have a portal 4598966. Sales Pro has been acquired. Despite this, I cannot create a new Deal and a new Product with API. I use test data with my real hapikey. I create objects as described in the API documentation.
For the "Create a Deal" API documentation:

For the "Create a product" API documentation:

Could you help me figure out what's wrong to create new Deal and Product


#50

Welcome, @greg!

I successfully created this deal and this product in your account via the APIs.

To troubleshoot further, I'll need a bit more information. Would you share:

  1. The raw request bodies you used.
  2. The full errors you received from HubSpot, including the status code.

#51

Hi @Isaac_Takushi
Thank for the feedback.
I use Python in my project.
To create a Deal, I use the url:
url = 'https://api.hubapi.com/deals/v1/deal?hapikey= '

Then I create the data for a Deal. For the variable "associatedVids", I assign the real value of the user that is added. For the variable "hubspot_owner_id" - owner's id. The rest of the data from the example in the API documentation (https://developers.hubspot.com/docs/methods/deals/create_deal):

deal_data = {
"associations": {
"associatedCompanyIds": ,
"associatedVids": [
3251
]
},
"properties": [
{
"value": "Tim's Newer Deal",
"name": "dealname"
},
{
"value": "appointmentscheduled",
"name": "dealstage"
},
{
"value": "default",
"name": "pipeline"
},
{
"value": "34050393",
"name": "hubspot_owner_id"
},
{
"value": 1409443200000,
"name": "closedate"
},
{
"value": "60000",
"name": "amount"
},
{
"value": "newbusiness",
"name": "dealtype"
}
]
}

After that I do a POST request:
req = requests.post (url, data=json.dumps(deal_data))

In response from your server I get <Response [200]>, but in fact nothing is added.
So I tried to create a product, set up settings for e-commerce, but my efforts failed.

I would be grateful for any help with this.
Thank.


#52

Hi @greg,

If you received a 200 response, you should receive confirmation of the deal as well:

{
  "portalId": 4598966,
  "dealId": 123456,
  "isDeleted": false,
  "associations": {
    "associatedVids": [
      3251
    ],
    "associatedCompanyIds": [ ]
  },
  "properties": {
    ...
  }

Do you get such a response or a blank 200?


#54

Thank you for help. I was able to add a new deal and a new product.
I am having difficulty adding products to the deal. What methods from API can I add products to a deal? I did not find in the API documentation anything that would help me do this.
Thanks.


#55

Hi @greg,

Happy to clarify.

Products can't be directly associated with deals. You'll have to create line items for the product using the Line Items API and the product's hs_product_id. You can then associate them with the deal using the CRM Associations API.

Product objects basically reflect a library of products while line items are specific instances of that product or service in the context of a deal. For example, you would not add a discount and quantity directly to a product, but you would to a line item.

Here are some related topics:


#56

I was getting same error(see below error) while creating line items using API.
{"status":"error","message":"Must have scope DEAL_LINE_ITEM_WRITE","correlationI d":"eaf84083-981f-423f-9433-fa84d8343f1b","requestId":"22b9757de88ccac4b34fe354c e31e6b6"}

Could you please give our portal access (4686199) to the Sale Pro API so we can create line items using hapikey.
We do have sales free on our production portal. Thanks!


#57

Can I please have it renewed for portal 4455895? Thank you!


#58

Hey, @mad,

You should be good to go (again)!


#59

Sorry I missed your post, @tejashviy.

Account 4686199 is a production account, not a test account. I will only grant Sales Pro access to developer test accounts.

If you have a developer test account to which you would like Sales Pro access added, let me know. Otherwise, you can talk to your account manager or HubSpot sales to upgrade to a Sales Hub Professional subscription.


Line items are not getting created for deal