I am sending a few floating point numbers through Rest API calls with the code snippet below
myFloatExamples = [0.45, -0.31, 1.3, -2.1]
for aNumber in myFloatExamples:
print("Read from array ", aNumber)
now = datetime.now().strftime('%M:%S')
payload = {'dimension1': 'X axis', 'dimension2': now, 'dimension3': aNumber}
# using json.dumps method to print and check if JSON has the floating point number correctly
print("Posting", json.dumps(payload))
# verify=False as SSL is self-signed
response = requests.post(url, headers=headers, json=payload, auth=(userID, password), verify=False)
print("Posted as ",response)
time.sleep(2)
I ran the above again after a couple of minutes by just changing the values in the array as below
myFloatExamples = [0.65, -0.74, 1.7, -2.6]
The output snippets (removed SSL warning messages) from the 2 executions is as below.
The json.dumps() method also shows the floating numbers correctly. I am constrained to think that I am doing everything I should to pass float numbers correctly to the rest API call.
Read from array 0.45
Posting {"dimension1": "X axis", "dimension2": "52:33", "dimension3": 0.45}
Posted as <Response [200]>
Read from array -0.31
Posting {"dimension1": "X axis", "dimension2": "52:40", "dimension3": -0.31}
Posted as <Response [200]>
Read from array 1.3
Posting {"dimension1": "X axis", "dimension2": "52:47", "dimension3": 1.3}
Posted as <Response [200]>
Read from array -2.1
Posting {"dimension1": "X axis", "dimension2": "52:54", "dimension3": -2.1}
Posted as <Response [200]>
Read from array 0.65
Posting {"dimension1": "X axis", "dimension2": "55:53", "dimension3": 0.65}
Posted as <Response [200]>
Read from array -0.74
Posting {"dimension1": "X axis", "dimension2": "56:00", "dimension3": -0.74}
Posted as <Response [200]>
Read from array 1.7
Posting {"dimension1": "X axis", "dimension2": "56:07", "dimension3": 1.7}
Posted as <Response [200]>
Read from array -2.6
Posting {"dimension1": "X axis", "dimension2": "56:14", "dimension3": -2.6}
Posted as <Response [200]>
However, when I look at the graph and the data on the graph, all the numbers are rounded off


Am I missing anything when passing float number to rest API calls?
I am sending a few floating point numbers through Rest API calls with the code snippet below
I ran the above again after a couple of minutes by just changing the values in the array as below
The output snippets (removed SSL warning messages) from the 2 executions is as below.
The json.dumps() method also shows the floating numbers correctly. I am constrained to think that I am doing everything I should to pass float numbers correctly to the rest API call.
However, when I look at the graph and the data on the graph, all the numbers are rounded off

Am I missing anything when passing float number to rest API calls?