我正在嘗試發(fā)布一個 GraphQL Mutation 并且遇到了一個我無法弄清楚的語法錯誤。我看到有一個關(guān)于轉(zhuǎn)義/非轉(zhuǎn)義字符的錯誤。我試過轉(zhuǎn)義,雙引號,單引號,沒有引號。我似乎無法解決這個問題。代碼下的回溯。# http headers for api callheaders = { 'accept': "application/json", 'content-type':"application/json", 'authorization': "bearer " + token,}# create inventory variable for mutation # will convert the csv to the json input in productioninventory:[{"supplier_id":24522,"supplier_part_number":"1-1002-9-SN","quantity_on_hand":5,"item_next_availability_date":"05-01-2018T00:00:00", "discontinued":true}]# payload of the json query to pass to the API#GraphQL Query to pull in Purchase Order Data payload = '''{"query":"mutation save_inventory($inventory: [inventoryInput]!) { inventory { save(inventory: $inventory, dry_run: true) { handle } }}"}'''# send API call and assign response to variableresponse = requests.post(api_url, data=payload, headers=headers)錯誤我無法在下面弄清楚。 {"errors":[{"message":"Syntax Error GraphQL (1:1) Unexpected <EOF>\n\n1: \n ^\n","category":"graphql","locations":[{"l ine":1,"column":1}]}]}
添加回答
舉報
0/150
提交
取消