We have our main BU (business unit) at the top of the tree, and one of the other BUs is TEST. In TEST we have created an Installed Package and in that installed package we have added a Server-to-Server API Integration. In the Access tab of that API Integration we've disabled the integration for the Parent BU, and have enabled it for the TEST BU.

When we make Rest API calls to the endpoint created in that API Integration we always get data from the "Main" BU, and not from the TEST BU.

If I create a contact that is available in both the Parent and TEST BU, but if I try to trigger an email based on a Triggered Send definition only the definitions created in the Parent BU are available and not the definitions from the TEST BU.

How can I access the data in the TEST BU from the Rest API? And why aren't the permissions preventing me from taking actions on the Parent BU?

  • Are you getting your OAuth token using the id/secret of the installed package? – Mike Mar 11 '19 at 17:15
  • 3
    are you adding in the account_id into your Access Token Request? I believe it is required to access any other than the parent BU. (developer.salesforce.com/docs/…) – Gortonington Mar 11 '19 at 17:25
  • 1
    @Gortonington that was exactly the issue. I was looking at this doc which doesn't show that option developer.salesforce.com/docs/… Want to put your comment as the answer so I can give you full credit – Jeremy Hutchinson Mar 11 '19 at 17:49
  • 1
    As a note, that documentation you provided is for the 'legacy' process. Which utilizing the v1/requestToken endpoint, not the new 'v2' authentications – Gortonington Mar 11 '19 at 17:53
  • 1
    I honestly am not sure, there is much still undocumented and 'incomplete' about this new authentication. E.g. it currently will not work with SOAP calls - you need to use legacy authentication or user/pass. This is a known issue to them and they are working on a fix for it. Perhaps your issue is another temporary issue due to a less then seamless release. – Gortonington Mar 11 '19 at 18:02

I believe the issue is stemming from the account_id option in your request for the access token. I believe it is required to access any other than the parent BU.

JSON Parameters for Request Access Token

|improve this answer|||||
  • As a note too, apparently if you only have 1 BU, if you do not put the MID in, it wont authenticate your calls – Gortonington Mar 13 '19 at 0:47
  • This worked for me, but it's a bummer because I'd prefer to pass the MID in the body of the call instead of during authentication. – garek007 Dec 11 '19 at 14:05
  • What I do is create multiple Auth keys up front for each BU I am going to use and then assign those tokens accordingly for each call. This way you do not need to do multiple calls back and forth during the process. – Gortonington Dec 11 '19 at 14:37
  • 1
    Yeah I am actually allowing user to pull from all BU, but then using a filter. It works fine, I just reauthenticate for that BU only when they make the request, but it's a bit slower I'd hoped. Thanks for posting the answer in any case, it definitely works. – garek007 Dec 11 '19 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.