I'm trying to write test cases in Python which basically check whether a particular setting in salesforce is enabled or not.
I'm currently trying to check whether Multi-Factor authentication for my Org is enabled/disabled through API calls. I have a dev account with Salesforce and when I went through the documentation in salesforce ,i came to know that these settings are present under metadata types > settings > SecuritySettings > SessionSettings > 'enableU2F'
found in this URL : https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_securitysettings.htm
But i'm not able to find/access it through API to check it's status. So far i've been able to do -
from salesforce_api import Salesforce
import requests
client = Salesforce(username='[email protected]',
password='xxx-xxx-xxx',
security_token='securitytokensecuritytoken')
response = requests.get('https://mycompanyname-dev-ed.my.salesforce.com/services/data/v48.0/metadata/deployRequest',
headers=client.connection.session.headers,
Is this the right approach ? Is what i'm trying to access even possible ?
CodePudding user response:
You should be able to use Tooling API to pull metadata.
Check what fields you get back when calling /services/data/v54.0/tooling/sobjects/SessionSettings/describe
And experiment with query /services/data/v54.0/tooling/query?q=SELECT IsU2Fenabled FROM SessionSettings