I'm working with a third-party HTTP API like this:
curl https://secure.phabricator.com/api/maniphest.edit \
-d "api.token=${API_TOKEN}" \
-d "transactions[0][type]=subscribers.add" \
-d "transactions[0][value][0]=${OWN_USER_PHID}" \
-d "transactions[0][value][1]=${ANOTHER_USER_PHID}"
Basically it's a POST request with a request body like this (if written in Python syntax):
{"api.token": "...", "transactions": [{"type": "...", "value": ["...", "..."]}]
You can see that transactions
is a nested array.
How do I encode such payload in Python? I'm using requests
to make the request if that matters.