Paste Search Dynamic
Recent pastes
salesforce query payload
  1. # your code goes here
  2. text = "query?q=select id, OwnerId From Account where PersonMobilePhone = '+917011022716'"
  3. payload = {
  4.         'is_soql': true,
  5.         'token': '17777737',
  6.         'method': 'post',
  7.         'query': text,
  8.         'data': {
  9.                 "LastName":"Rawat",
  10.                 "FirstName":"Sparsh"
  11.         }
  12.        
  13. }
  14.  
  15. headers = {
  16.     'Content-type': 'application/json',
  17.     'Accept-Encoding': 'gzip',
  18. }
  19.  
  20. def salesforce_query(**kwargs):
  21.     is_soql = kwargs['is_soql']
  22.     headers['Authorization'] = f"Bearer {kwargs['token']}"
  23.     domain = "sparsh"
  24.     method = kwargs['method']
  25.     query = kwargs['query']
  26.     new  = []
  27.    
  28.     if not len(new):
  29.         print(new)
  30.     else:
  31.         print('hi')
  32.  
  33.     modify_query = query.replace(' ','+').replace('+91','%2B91') if is_soql else query
  34.     url = f"{domain}/services/data/v53.0/{modify_query}"
  35.  
  36.     return [url, headers] if method == 'get' else [url,headers,kwargs['data']]
  37.  
  38. print(salesforce_query(**payload))
Parsed in 0.016 seconds