Python Script with JSON
Budget: €8 – €30 EUR
Hello,
I want to check if my customers have a partner called "SP"
My code is:
import requests
import json
from re import search
url = "http://localhost:1207/api/C001/customer"
data = {
"customerQueryBuilder": {
"fieldGroups": [
[
{
"field": {
"name": "CUSTOMER_ID",
"filterType": "MULTI_MATCH"
},
"value": {
"values": ["1800861","1759256"]
}
}
]
]
},
"fullTextQuery": {
}
}
headers = {'Content-type': 'application/json'}
r = requests.get(url, data=json.dumps(data), headers=headers)
(r.status_code)
res=(r.text)
print (res)
json_data = json.loads(r.text)
sp= 'SP'
if res.find(sp) != -1:
print ('OK')
else:
print('NOK')
I want to check if my customers have a partner called "SP"
My code is:
import requests
import json
from re import search
url = "http://localhost:1207/api/C001/customer"
data = {
"customerQueryBuilder": {
"fieldGroups": [
[
{
"field": {
"name": "CUSTOMER_ID",
"filterType": "MULTI_MATCH"
},
"value": {
"values": ["1800861","1759256"]
}
}
]
]
},
"fullTextQuery": {
}
}
headers = {'Content-type': 'application/json'}
r = requests.get(url, data=json.dumps(data), headers=headers)
(r.status_code)
res=(r.text)
print (res)
json_data = json.loads(r.text)
sp= 'SP'
if res.find(sp) != -1:
print ('OK')
else:
print('NOK')