Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1486

Python POST to API requests issue

$
0
0

I've been working on making API tests with pytest on Python 3.10.10 and I have stumbled on an issue with a post request. Here is the code I currently have:

import requests as reqapi = 'some api'header = {'Apikey': 'some token','Content-Type': 'application/json'}payload = {"title": "TItle","description": "<p>DEscription</p>","column_id": 12345,"lane_id": 1234}URL = api +'/cards'card_id = 0def test_get_card():    x = req.get(        URL,        headers=header,        params={'cards_id': 123456}    )    assert x.status_code == 200def test_create_card():    x = req.post(        URL,        headers=header,        data=payload    ).json()    print(x)    assert x.status_code == 200

The first test is a success!The second though returns 400 and

Please provide a column_id for the new card with reference CCR or have it copied from an existing card by using card_properties_to_copy.

If I run the same request in Insomnia it returns 200. I can't figure out why it fails.


Viewing all articles
Browse latest Browse all 1486

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>