# Bad Request creating Ecommerce property mappings

**URL:** <https://community.hubspot.com/t/bad-request-creating-ecommerce-property-mappings/12766>\
**Category:** APIs & Integrations\
**Created:** [February 5, 2019, 12:19am UTC](https://community.hubspot.com/t/bad-request-creating-ecommerce-property-mappings/12766 "2019-02-05T00:19:20Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![aemmi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/aemmi/32/84335_2.png) [@aemmi](https://community.hubspot.com/u/aemmi)\
**Post date:** [February 5, 2019, 12:19am UTC](https://community.hubspot.com/t/bad-request-creating-ecommerce-property-mappings/12766/1 "2019-02-05T00:19:20Z")

</div>

When I submit a PUT request to set up property mapping I receive a 400 Bad Request. I’m using this url [https://api.hubapi.com/extensions/ecomm/v1/settings?hapikey=56af5b68......&appId=397](https://api.hubapi.com/extensions/ecomm/v1/settings?hapikey=56af5b68......&appId=397)… Whatt is wrong with this request the body is

```auto
{
 "enabled": true,
 "importOnInstall": true,
 "productSyncSettings": {
 "properties": [
 {
 "propertyName": "product_name",
 "dataType": "STRING",
 "targetHubspotProperty": "productname"
 },
 {
 "propertyName": "imageUrl",
 "dataType": "AVATAR_IMAGE",
 "targetHubSpotProperty": "ip __ecomm_bridge__ image_url"
 }
 ]
 },
 "dealSyncSettings": {
 "properties": [
 {
 "propertyName": "order_total",
 "dataType": "NUMBER",
 "targetHubspotProperty": "amount"
 },
 {
 "propertyName": "customer_id",
 "dataType": "STRING",
 "targetHubspotProperty": "hs_assoc__contact_ids"
 },
 {
 "propertyName": "purchase_date",
 "dataType": "DATETIME",
 "targetHubspotProperty": "closedate"
 },
 {
 "propertyName": "stage",
 "dataType": "STRING",
 "targetHubspotProperty": "dealstage"
 }
 ]
 },
 "lineItemSyncSettings": {
 "properties": [
 {
 "propertyName": "order_id",
 "dataType": "STRING",
 "targetHubspotProperty": "hs_assoc__deal_id"
 },
 {
 "propertyName": "product_id",
 "dataType": "STRING",
 "targetHubspotProperty": "hs_assoc__product_id"
 }
 ]
 },
 "contactSyncSettings": {
 "properties": [
 {
 "propertyName": "given_name",
 "dataType": "STRING",
 "targetHubspotProperty": "firstname"
 },
 {
 "propertyName": "family_name",
 "dataType": "STRING",
 "targetHubspotProperty": "lastname"
 },
 {
 "propertyName": "email",
 "dataType": "STRING",
 "targetHubspotProperty": "email"
 }
 ]
 }
}

```

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [February 6, 2019, 3:45pm UTC](https://community.hubspot.com/t/bad-request-creating-ecommerce-property-mappings/12766/2 "2019-02-06T15:45:31Z")

</div>

Hi, @aemmi.

Apologies for the inconvenience.

The `400` error code I received cited something wrong with the:

```auto
{
 "propertyName": "imageUrl",
 "dataType": "AVATAR_IMAGE",
 "targetHubSpotProperty": "ip __ecomm_bridge__ image_url"
}

```

mapping, but I couldn’t find any issues with it.

I ended up building the settings one group at a time and they should now be uploaded successfully. Can you confirm with [this endpoint](https://developers.hubspot.com/docs/methods/ecommerce/get-settings)?

---

<div class="post-metadata">

**Author:** ![aemmi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/aemmi/32/84335_2.png) [@aemmi](https://community.hubspot.com/u/aemmi)\
**Post date:** [February 6, 2019, 4:25pm UTC](https://community.hubspot.com/t/bad-request-creating-ecommerce-property-mappings/12766/3 "2019-02-06T16:25:04Z")

</div>

Thank you for responding

I was able to verify those setting, I removed the imageUrl that you indicated was an issue and tried again but received the same 400 Bad Request. We do have OAuth setup and use it for all our other API calls, should I even be using this extensions/ecomm/v1/settings endpoint. If I can’t get past the 400 Bad Request how would I make changes to the mappings?

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [February 7, 2019, 3:59pm UTC](https://community.hubspot.com/t/bad-request-creating-ecommerce-property-mappings/12766/4 "2019-02-07T15:59:55Z")

</div>

Hi, @aemmi.

Sorry to hear that you encountered another `400` error.

I’m not sure exactly why you’re seeing that error, as I was able to successfully update your mappings and add this dummy mapping:

```auto
{ "propertyName": "fooBarUrl",
 "dataType": "AVATAR_IMAGE",
 "targetHubspotProperty": "ip __ecomm_bridge__ image_url"
}

```

I have since removed this mapping, but could you share the full settings you are trying to upsert (assuming they are different than your initial post)?  
Even though you use OAuth for all your other API requests, upserting settings must be done with your developer API key, per [this documentation](https://developers.hubspot.com/docs/methods/ecommerce/get-settings). This is because you editing the settings of your _app_ and not data in an account which has installed your app.

---

<div class="post-metadata">

**Author:** ![aemmi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/aemmi/32/84335_2.png) [@aemmi](https://community.hubspot.com/u/aemmi)\
**Post date:** [February 7, 2019, 4:03pm UTC](https://community.hubspot.com/t/bad-request-creating-ecommerce-property-mappings/12766/5 "2019-02-07T16:03:01Z")

</div>

Issac,

Thanks for the update, other than this [api.hubapi.com/extensions/ecomm/v1/settings](http://api.hubapi.com/extensions/ecomm/v1/settings) how else can I check the setting or update them. Is this only done through the API?

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [February 7, 2019, 4:06pm UTC](https://community.hubspot.com/t/bad-request-creating-ecommerce-property-mappings/12766/6 "2019-02-07T16:06:44Z")

</div>

Hi, @aemmi.

Sorry we were typing at the same time!

Yes, those settings can only be retrieved and modified via the API — at this time, there is no UI for Ecommerce Bridge mappings.

---

<div class="post-metadata">

**Author:** ![aemmi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/aemmi/32/84335_2.png) [@aemmi](https://community.hubspot.com/u/aemmi)\
**Post date:** [February 7, 2019, 4:10pm UTC](https://community.hubspot.com/t/bad-request-creating-ecommerce-property-mappings/12766/7 "2019-02-07T16:10:04Z")

</div>

Thank You I’m have trouble on my end using https so I have been using http, could this be my issue?

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [February 7, 2019, 4:29pm UTC](https://community.hubspot.com/t/bad-request-creating-ecommerce-property-mappings/12766/8 "2019-02-07T16:29:51Z")

</div>

Hey, @aemmi.

That could be part of the issue, however I was just able to add and remove another dummy contact property mapping using `http://api.hubapi.com/extensions/ecomm/v1/settings?hapikey=your_developer_api_key&appId=your_app_id`.

If you share the full set of mappings you’re trying to upsert, I’d like to try again myself.

---

<div class="post-metadata">

**Author:** ![aemmi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/aemmi/32/84335_2.png) [@aemmi](https://community.hubspot.com/u/aemmi)\
**Post date:** [February 7, 2019, 7:28pm UTC](https://community.hubspot.com/t/bad-request-creating-ecommerce-property-mappings/12766/9 "2019-02-07T19:28:57Z")

</div>

Issac,

I believe I know what was causing my Bad Request. In my headers I had a nullvalue for Content-Length. I corrected that and now I’m receiving {“message”:“Value from portalId does not match hub-id implied by authorization used: 3977210 (oauth) vs 4445704 (portalId)”,“correlationId”:“202f9d86-bfdc-4f33-94a2-d5355e54fd3b”,“requestId”:“2fe5c8789c482412f5179b5a1a658459”} error.

My url is [http://api.hubapi.com/extensions/ecomm/v1/settings?hapikey=56af5b68-xxx&appId=145xxx](http://api.hubapi.com/extensions/ecomm/v1/settings?hapikey=56af5b68-xxx&appId=145xxx)

Can you determine what isn’t setup properly

---

<div class="post-metadata">

**Author:** ![aemmi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/aemmi/32/84335_2.png) [@aemmi](https://community.hubspot.com/u/aemmi)\
**Post date:** [February 7, 2019, 7:37pm UTC](https://community.hubspot.com/t/bad-request-creating-ecommerce-property-mappings/12766/10 "2019-02-07T19:37:31Z")

</div>

Issac,

Update I was able to process a successful mappings setting. I removed the Authorization’,'Bearer from the header. I thought I had to include this since we do use OAuth for our transactional emails. Is this not the case?

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [February 8, 2019, 4:33pm UTC](https://community.hubspot.com/t/bad-request-creating-ecommerce-property-mappings/12766/11 "2019-02-08T16:33:44Z")

</div>

Apologies for the delayed response, @aemmi. I’m glad to hear you got this working!

The [Upsert](https://developers.hubspot.com/docs/methods/ecommerce/upsert-settings) and [Get ecommerce settings](https://developers.hubspot.com/docs/methods/ecommerce/get-settings) endpoints are a bit special. As I mention above:

_Even though you use OAuth for all your other API requests, upserting settings must be done with your developer API key, per [this documentation](https://developers.hubspot.com/docs/methods/ecommerce/get-settings). This is because you editing the settings of your app and not data in an account which has installed your app._

Said differently, HubSpot wouldn’t recognize the OAuth token for one particular account (Hub ID) because you are trying to change the settings of your app _across_ all accounts.

Thus, you should never have to use _both_ an OAuth token _and_ your developer API key. You will only ever use one or the other. In this case, the endpoints only accept your developer API key.

---

<div class="post-metadata">

**Author:** ![aemmi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/aemmi/32/84335_2.png) [@aemmi](https://community.hubspot.com/u/aemmi)\
**Post date:** [February 11, 2019, 3:42pm UTC](https://community.hubspot.com/t/bad-request-creating-ecommerce-property-mappings/12766/12 "2019-02-11T15:42:49Z")

</div>

Thank You Issac,

I’m attempting to sync messages to this end point [http://api.hubapi.com/extensions/ecomm/v1/sync-messages/PRODUCT](http://api.hubapi.com/extensions/ecomm/v1/sync-messages/PRODUCT) and the attached code trying the developer HPIKEY , the app APIKEY or the OAuth and each time I receive this response {“message”:“This OAuth token (CM7nyu…) has not authorized the required scopes to complete this action, requires all of the following: [integration-sync]. Visit [Working with OAuth - HubSpot docs](https://developers.hubspot.com/scopes) for more information.”,“correlationId”:“22a72400-d9ef-484d-8f0b-9e14a2d3d41b”,“requestId”:“0c8664d9a684827dbf0cdfba0eb4d571”} even though I have intergration sync setup. Is there a step I need to do before this step. How is this step different than the import process

 ![authorization.JPG](https://d2qpr2jzcazej7.cloudfront.net/original/2X/b/b560c3170e6d42cef57b904f2d3b5cb73508d133.jpeg)

`[{"integratorObjectId": "39","action": "UPSERT","changeOccurredTimestamp":153029475925,"propertyNameToValues": {"product_id": "39","product_name": "066-0811"} },{"integratorObjectId": "40","action": "UPSERT","changeOccurredTimestamp":153029475925,"propertyNameToValues": {"product_id": "40","product_name": "066-1117"}}]`
