DataFolder | salesforcedataextension | access_token | API Permission Failed error
Trailblazer Community

DataFolder | salesforcedataextension | access_token | API Permission Failed error

Marketing Cloud API

Last updated 2020-06-15 ·Reference W-7219450 ·Reported By 1 users

Fixed in version Marketing Cloud Release May 2020

Summary
The call to create a Salesforce Data Extensions folder fails when utilizing ClientID/ClientSecret Authentication/token-based authentication.

Repro
1. In Marketing Cloud, go to Setup under Settings. Open Installed Packages.
2. Click the New button, add the name for the package, and click the Save button.
3. Under components, click Add component.
4. Select API Integration as the Component Type. Click next.
5. Select server to server as the integration type. Click Next.
6. Under the scope, click all available properties. Click Save.
7. Run the REST call using the client_id and client_secret from the package to pull an access token. Update the TSE and MID in the call.

https://[TSE].auth.marketingcloudapis.com/v2/token


{
"grant_type": "client_credentials",
"client_id": "[CLIENT ID]",
"client_secret": "[CLIENT_SECRET]",
"account_id": [MID]"
}



8. Use the access_token from the response to try to create a Salesforce DE child folder. You will need to update the TSE, access_token and SF DE folder id in the call,


<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing"" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">;

<s:Header>
<a:Action s:mustUnderstand="1">Create</a:Action>
<a:To s:mustUnderstand="1">https://[TSE].soap.marketingcloudapis.com/Service.asmx</a:To>;
<fueloauth xmlns="http://exacttarget.com">;[access_token]</fueloauth>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd="http://www.w3.org/2001/XMLSchema">;
<CreateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">;
<Objects xsi:type="DataFolder">
<PartnerKey xsi:nil="true"/>
<ObjectID xsi:nil="true"/>
<CustomerKey>SOAPTest_Oauth 02122020</CustomerKey>
<ParentFolder>
<ID>[SALESFORCE DE FOLDER ID]</ID>
</ParentFolder>
<Name>SOAPTest_OAUTH 02122020</Name>
<Description>SOAP Test</Description>
<ContentType>salesforcedataextension</ContentType>
<IsActive>true</IsActive>
<IsEditable>true</IsEditable>
<AllowChildren>true</AllowChildren>
</Objects>
</CreateRequest>
</s:Body>
</s:Envelope>


The response from the call will be as follows

<CreateResponse xmlns="http://exacttarget.com/wsdl/partnerAPI">;
<Results>
<StatusCode>Error</StatusCode>
<StatusMessage>API Permission Failed.</StatusMessage>
<OrdinalID>0</OrdinalID>
<ErrorCode>7</ErrorCode>
<NewID>0</NewID>
</Results>
<RequestID>45014f0a-42d5-4d53-a8c0-30565816380f</RequestID>
<OverallStatus>Error</OverallStatus>
</CreateResponse>

Workaround
Use password authentication or create these through the UI.

Reported By (1)

Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.