change rate through api

Hey so I’m trying to change the rate through the API. As best I can determine from documentation and from observing changes, I should just have to update roadall so that the current rate ends a week from now and append a new rate to the end of roadall that ends sometime in the future.

Current my code which does this returns a 500 error and nothing more descriptive than “internal server error”

Below is a code snippet that shows what I’m doing. Any help in this matter would be greatly appreciated.

        old_rate_end_date = ( + datetime.timedelta(days=7)).strftime("%Y-%m-%d")
        new_rate_end_date = ( + datetime.timedelta(days=3650)).strftime("%Y-%m-%d")
        self.roadall[-1][0] = old_rate_end_date
        self.roadall.append([new_rate_end_date, None, new_rate])
        payload = {
            "auth_token": TOKEN,
            "roadall": self.roadall
        request = URL + "/users/" + USERNAME + "/goals/" + + ".json"
        resp = requests.put(request, data=payload)
1 Like

Double-check your date formatting, and paste an example of a payload (without any auth information) here and I can take a look.


payload looks like

{'auth_token': 'secret', 'roadall': [[1595131200, 0.0, None], [1595692800, None, 0], [1598112000, None, 4.348214285714286], [1598198400, None, 4], ['2020-08-23', None, 4.1], ['2030-08-14', None, 4.3]]}

documentation says these daystamps should work but I’ve also tried unix timestamps with the same result.

Appreciate you taking a look.

1 Like

How is None being represented when it gets sent as json? Can you send over that level too?


I got it! You were right that it was related to me sending over None instead of null. converting the array to json before sending it worked.

Thanks so much for your help.

1 Like