def main(): args = sys.argv check_args(args, 2) msf = LibMtSalesForce() id = args[1] session_id__c = args[2] api_path = 'sobjects/Account/%s?_HttpMethod=PATCH' % (id) payload = {"SessionId__c": session_id__c} response = msf.http_request(api_path, method='POST', data=payload) return response.content.decode() # byte->string
def main(): """ Object名を指定して/sobjects/オブジェクト名/' のsf_apiを実行する。 """ args = sys.argv check_args(args, 2) object_name = args[1] id = args[2] # idが不要な場合もある..? msf = LibMtSalesForce() api_path = 'sobjects/%s/%s' % (object_name, id) payload = {} response = msf.http_request(api_path, method='GET', data=payload) return response.content.decode() # byte->string
def main(): """ """ # TODO: パラメータでjson取得 file = open('./data/post_sobject.json', 'r') data = json.load(file) args = sys.argv check_args(args, 1) object_name = args[1] msf = LibMtSalesForce() api_path = 'sobjects/%s/' % (object_name) response = msf.http_request(api_path, method='POST', data=data) p(response) return response.content.decode() # byte->string
def main(): """ SalesforceのLightning Platform REST API にリクエスト Excel 5行目 """ # https://cs6.salesforce.com/services/data/v28.0/sobjects/Account/001N000001HsLSUIA3?_HttpMethod=PATCH args = sys.argv check_args(args, 2) # init account_id = args[1] session_id = args[1] msf = LibMtSalesForce() # main api_path = 'sobjects/Account/%s?_HttpMethod=PATCH' % (account_id) data = {'SessionId__c': session_id} response = msf.http_request(api_path, 'POST', data) return response