Create Pricing Feed
1 min
code examples curl request post \\ \ url https //api upstartcommerce com/v1/pricingfeed \\ \ header 'accept application/json' \\ \ header 'content type multipart/form data' \\ \ header 'x upstart tenant string' \\ \ header 'x upstart site string' \\ \ form 'filetype="string"' \\ \ form 'file=@"/path/to/file"'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "multipart/form data"); myheaders append("x upstart tenant", "string"); myheaders append("x upstart site", "string"); var formdata = new formdata(); formdata append("filetype", "string"); formdata append("file", fileinput files\[0], "file"); var requestoptions = { method 'post', headers myheaders, body formdata, redirect 'follow' }; fetch("https //api upstartcommerce com/v1/pricingfeed", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "net/http" url = uri("https //api upstartcommerce com/v1/pricingfeed") https = net http new(url host, url port) https use ssl = true request = net http post new(url) request\["accept"] = "application/json" request\["content type"] = "multipart/form data" request\["x upstart tenant"] = "string" request\["x upstart site"] = "string" form data = \[\['filetype', file open('undefined')],\['file', file open('/path/to/file')]] request set form form data, 'multipart/form data' response = https request(request) puts response read body import requests url = "https //api upstartcommerce com/v1/pricingfeed" payload = {} files=\[ ('file',('file',open('/path/to/file','rb'),'application/octet stream')) ] headers = { 'accept' 'application/json', 'content type' 'multipart/form data', 'x upstart tenant' 'string', 'x upstart site' 'string' } response = requests request("post", url, headers=headers, data=payload, files=files) print(response text) responses // feed file created with feed id { "id" "" }// the request contained information that the server was unable to process appropriate errors are provided in the response body { "name" "", "code" "", "detail" \[ "" ], "reason" "" }// the provided credentials were not valid for this endpoint it may be that they are expired or that the user's roles are insufficient { "name" "", "code" "", "detail" "", "reason" "" }