Discussions

Ask a Question
Back to All

How do you format create transaction statement?

Hi,

I'm working with the Claravine API in python right now to try to programmatically create some new transactions using data I have on my local machine. I have used the Claravine API to get historical transactions successfully, but this POST method isn't working

Here's an example of what I'm running in python:

"""

url = "https://api.claravine.com/v1/datasets/xxx/dataset/data"

headers = {
"accept": "application/json",
"x-claravine-key": "xxx",
"x-claravine-secret": "xxx",
"fields":fields,
"rows":rows
}

response = requests.post(url, headers=headers)

print(response.text)

"""

I have my actual dataset uuid in the url, as well as my real api key and secret in headers. fields is a python list of the columns of the data I'm trying to load into Claravine, and rows is a nested python list of the row values. This is exactly how the data looks when I'm receiving it from a get request. However, this error is being thrown when I try to run it:

Header part [xxx...]

(my fields list) must be of type str or bytes, not <class 'list'>

I think this has to do with the requests library in python, that maybe it can only take those two data types as arguments in the headers object. I tried again with both fields and rows converted to strings but that didn't work either

How would I fix this?

Thank you