Skip to main content

Hi all, 

Is there a way to switch branches for the account used for Oauth? Our vendors are set up with Restricted company groups. When our api automation tries to create a Bill the user used in the Oauth authentication, it is set to one of our 10 branches, so the Bill PUT fails due to the branch being incorrect. During the automation we'll need to switch branches. 

I looked for a profile endpoint to maybe use and switch branches using the api, but didn't see one. Thoughts?

Thanks!

Please refer to this topic: https://help.acumatica.com/(W(114))/Help?ScreenId=ShowWiki&pageid=9821cff9-4970-4153-a0f8-dbf5758133a7


Hi @jamest ,

As far I know, For the branch, we don't have any parameters or conditions.

Have you got This link?

Regards,

Sweta


this is correct. 

The idea is that you should not really set Branch for a session when you use OAuth. You should provide the branch in the request header with each request. 
The header is 
PX-CbApiBranch

See details here: https://help.acumatica.com/(W(1))/Help?ScreenId=ShowWiki&pageid=9821cff9-4970-4153-a0f8-dbf5758133a7

During my testing locally, I was able to use this header to change branch(review Cookie UserBranch value). 
I made a token call(return cookie UserBranch 16)
Next made a get call and set PX-BcApiBranch header to Products Retail > cookie value for UserBranch changes to 20

 


This was exactly what I need and it worked! Thanks! I even looked at this help tutorial and I just missed it. 


this is correct. 

The idea is that you should not really set Branch for a session when you use OAuth. You should provide the branch in the request header with each request. 
The header is 
PX-CbApiBranch

See details here: https://help.acumatica.com/(W(1))/Help?ScreenId=ShowWiki&pageid=9821cff9-4970-4153-a0f8-dbf5758133a7

During my testing locally, I was able to use this header to change branch(review Cookie UserBranch value). 
I made a token call(return cookie UserBranch 16)
Next made a get call and set PX-BcApiBranch header to Products Retail > cookie value for UserBranch changes to 20

 

Yep, this worked!

 

Thanks!


Sorry, I marked the wrong “right” answer for my situation. @RohitRattan88  and @kpopova answers worked for me. 


@jamest - I have corrected the marked answered


Reply