APIs & Integrations

JSargent38
Member

E-Commerce Scope not working with Private App

Hi there,

I recently found myself needing the products API so I added e-commerce as a scope for the private app and committed the changes, however I am still getting a 403 when trying to create a product. I even created a brand new private app and tried that, same result. 

I also tried sending a test request from your API docs with my access token just to make sure nothing in my code was the issue. Using this feature.

JSargent38_2-1666017962946.png

Same result...



Here you can clearly see e-commerce is in my list of scopes. 

JSargent38_0-1666017655944.png


This is the error I am receiving, pulled from the logs. 

JSargent38_1-1666017842558.png

 

0 Upvotes
2 Replies 2
Jaycee_Lewis
Community Manager
Community Manager

E-Commerce Scope not working with Private App

Hey, @JSargent38 👋 Thanks for reaching out. I ran a simplified test just now and was able to create a product using a private app for authorization.

 

My steps:

  • I created a new private app with only the ecommerce scope
    CleanShot 2022-10-18 at 11.06.22.png
  •  I used this endpoint
    POST /crm/v3/objects/products​
  • Request
    curl --request POST \
      --url https://api.hubapi.com/crm/v3/objects/products \
      --header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
      --header 'content-type: application/json' \
      --data '{
      "properties": {
        "description": "3-ring cat circus",
        "hs_cost_of_goods_sold": "6000.00",
        "hs_sku": "191902",
        "name": "Implementation Service ",
        "price": "60000.00"
      }
    }'​
  • Response
    HTTP 201
    
    {
      "id": "1629259909",
      "properties": {
        "createdate": "2022-10-18T16:53:57.839Z",
        "description": "3-ring cat circus",
        "hs_cost_of_goods_sold": "6000.00",
        "hs_lastmodifieddate": "2022-10-18T16:53:57.839Z",
        "hs_object_id": "1629259909",
        "hs_sku": "191902",
        "name": "Implementation Service ",
        "price": "60000.00"
      },
      "createdAt": "2022-10-18T16:53:57.839Z",
      "updatedAt": "2022-10-18T16:53:57.839Z",
      "archived": false
    }​

My suggestion is to try using a simplified approach like above. And then either remove and re-add the ecommerce scope to your private app, or update your new private app with the remaining scopes after you confirm it works as expected.

 

Have fun building!  — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
05883
Member

E-Commerce Scope not working with Private App

Hi! I actually tried this very call on Postman as a test and the response says that i require the e-commerce scopes, which i can select only as "request" (not as "read" and "write" like the others objects)

As a matter of fact i can get the products by API but cannot create any.

I'm  missing some permissions? Thank you very much for your time.

0 Upvotes