Rest api for Salesforce Markting Cloud (ExactTarget) returns Categories from Parent Business Unit - exacttarget

I have two business units in my salesforce marketing cloud account with different folders structures. For example Parent Business Unit (PBU) has 3 folders by name ABC, PQR, and XYZ and Child Business Unit(CBU) has 2 folders by name AA,BB.
When I run the OAuth2.0 end point get the token using client id and secret of CBU and pass the token to get categories endpoint, the response gives me categories of the PBU i.e. ABC,PQR,XYZ.
Is there any setting in salesforce which I need to do which will return assets of specific BUs using rest endpoints?
Thanks,
Swapnil

You will have to add the clientID within your API code to get the data from the specific Business Unit. This document will be helpful - https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/using_clientid_in_your_soap_api_code.htm

Related

How can multiple different users use the same rest api on a platform to pull their unique data?

I want to build a project where a user will be able to press on a button to authorize my platform to access their data (e.g shopify data). When my platform has access (to their shopify platform) it will send that data to my database.
My questions is:
In order for my rest api to access the data (from e.g shopify platform) i have to give the rest api the api key of the user which is simple if it a single account, but when i have multiple users using the same rest api how should i handle it? How can i give the rest api the access code so it can pull the data (from e.g their shopify platform) for each user? What is the name of the technology that needs to be considered here?
I am a built lost on the terminology of my question which has given me a bit of a headache when trying to google it.
First off, you create an App that Shopify approves, and then your merchant customers would install this App in their store. That approval process by both Shopify and the merchant means you are given permission to access their Shopify data.
Next, you create some value by allowing the merchant to see their data in ways unique to what it is you are doing. So far, your database contains nothing but the name of the store and the access token with permission to access the Shopify API.
How you then proceed in your own App is up to you. Not much else to it really, if you already know what your value add is. Code that part up and you're done!

Azure API Management product subscription tracking

I am using Azure API Management for managing our APIs. Its containing product and all. Now I also want to catch some of the customer information into my database.
So my question is : "Is there anyway such that whenever someone is subscribing any product, my API will trigger?"
What I want to do is I will create an API which will fetch the details from Azure via REST API for all subscriptions and I want to call (auto trigger) that API whenever someone subscribe any product successfully. I know we can set the Approval workflow, we can send notification email also to any specific email id, but can we call any HTTP request?
Also if anyone have more idea about Developer portal then please share. (can we customize it, till what level, how, etc.)
Thanks in Advance..
One way is to put an Event Grid system topic on the resource group containing API Management service with
filter for Resource Write Success
subject filter / Subject begins with /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.ApiManagement/service/{apiManagementService}/subscriptions
and forward to Azure Function or WebHook - basically filter for activities logged as Subscribe to product or Update subscription on the resource.

NodeJs Multi-vendor site and product accessing

I've been working on a NodeJs web application that uses APi's and a number of differently branded Front-end's for different sellers. Sellers can list their product by visiting appropriate Front-End. However I've hit a problem where there is no logic preventing sellers accessing other seller accounts.
There are several API's that interact with the product, so an idea was to filter all API's against the seller ID to prevent the wrong seller accessing the wrong product. i.e When Seller A lists a product, an sellerID is recorded against product. So if Seller B tries to access the UpdateProducts API against Seller A product, their Login ID will not match the saved sellerID and it will be denied. I think this will work but checking access against products sounds taxing. Are there any better way to do this ?
Before accessing any data from database every request should be checked if it has token authorization. If token is valid, it is possible to get userId from token and search any data for the given userId.
P.S. This approach I'm using in REST API

Store data in Stripe to be sent back as part of web hook data?

I am working for the first time with Stripe. I am using stand alone accounts. I have a platform account also. In my web site a number of people with different Stripe accounts will be opening up campaigns for which money can be donated by various donors. Each campaign owner has a separate stripe account and the platform will be charging through the campaign owner's stripe account.
So what it amounts to is the platform account will be charging for a number of campaigns through each campaign owner's Stripe account. My problem is related to web hooks. One point to remember is each campaign has an id associated with it in the database and I am storing the API key of each campaign owner's stripe account and associating it with this id. To get Stripe data from the web hook in the web hook end point I have to set the API key of the connected account with a statement like:
\Stripe\Stripe::setApiKey("api key of stand alone account");
$input = #file_get_contents("php://input");
The trouble with this is there is one web hook end point for a number of Stripe accounts. I cannot hard-code the API key in the above statement. I have to fetch the appropriate API key from my database using the id.
But when Stripe invokes the web hook end point I simply do not have the campaign id with me in order to fetch the appropriate API key and set the API key. Is there any solution around this?
You don't need to store each account's API key. The only information you need to store is the account ID ("acct_..."). With standalone accounts, your integration will receive the account ID in the last step of the OAuth flow, in the stripe_user_id parameter.
You can then issue API requests on behalf of this account by using your own (the platform's) API key, and the Stripe-Account header.
Regarding webhooks specifically, events sent to your server via a "Connect" endpoint will include a user_id field with the account ID. So you can do something like this:
\Stripe\Stripe::setApiKey("PLATFORM_API_KEY");
$input = #file_get_contents("php://input");
$event_json = json_decode($input);
$user_id = $event_json->user_id;
// if you need to send an API request on behalf of this account,
// for example if you want to verify the event by fetching it from
// Stripe, you can use the Stripe-Account header:
$event = \Stripe\Event::retrieve(
$event_json->id,
array("stripe_account" => $user_id)
);

How do you get the DocuSign Account ID using the API?

In the DocuSign GUI it shows a number in the top right corner which I presume is the company account ID. If your user is in multiple company accounts then you can switch between these accounts and the number changes. My demo account ID's are 17107 and 1133955.
I cannot find a way to get this ID using the API. I need it because a customer has multiple accounts with the same company name and we need to show the same account ID to them so they can differentiate between the accounts in our GUI like they can in the DocuSign GUI.
With the Credential API I can get the list of accounts for the user but the account ID here is the API account ID which is a GUID, not an integer.
Using a simple Login API call you'll get a list of the user's accounts. Each of the loginAccount objects within that list also contains an accountId parameter.
Please see the documentation regarding the login_information REST API call:
https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#REST API References/Login.htm?Highlight=login_information

Resources