Question: I'm learning to work with requests and JSON, so I decided to use API of the app I heavily use. I've successfully made requests to receive an auth code and access token, so I can get the content with the request like this:

```
requests.post('https://getpocket.com/v3/get',
               data = {'consumer_key' : consumer_key,
                       'access_token' : access_token,
                         'detailType' : 'simple',
                              'count' : '50'})

```

But when I want to modify entries, I build the similar request, which doesn't work for some reason:

```
requests.post('https://getpocket.com/v3/send',
               data = {'consumer_key' : consumer_key,
                       'access_token' : access_token,
                            'actions' : [{'item_id':'1000000000','action':'archive'}]})

```

The [API guide](https://getpocket.com/developer/docs/v3/modify#action_archive) suggests the following valid example (I decoded it for visibility):

```
https://getpocket.com/v3/send?actions=[{"action":"archive","time":1348853312,"item_id":229279689}]&access_token=ACCESS_TOKEN&consumer_key=CONSUMER_KEY

```

I get the error "400 Bad Request" and one of the headers says: "Invalid request, please refer to API documentation".

Is there anything I'm doing wrong with the syntax?

Answer: 
From your example:

```
https://getpocket.com/v3/send?\
  actions=[{"action":"archive","time":1348853312,"item_id":229279689}]&\
  access_token=ACCESS_TOKEN&\
  consumer_key=CONSUMER_KEY

```

we see there are three URL-encoded parameters, only *one* of which (`actions`) is a JSON value. You need to use something like

```
actions = {
    "action": "archive",
    "time": "1348853312",
    "item_id": "229279689"
}
requests.post("https://getpocket.com/v3/send",
              data={
                  "actions": json.dumps(actions),
                  "access_token": access_token,
                  "consumer_key": consumer_key
              })

```
It seems that the API requires the parameters to be on the URL, but you're sending on the post body.

You should encode you dictionary into the URL:

```
from urllib.parse import urlencode

data = {
        'consumer_key' : consumer_key,
        'access_token' : access_token,
        'actions' : [{'item_id':'1000000000','action':'archive'
       }
requests.post('https://getpocket.com/v3/send/?' + urlencode(data))

```