Terug naar alle discussies
POST request not working
cedk
vor 10 Monaten
Hi, today the POST request /teams/search?sport_id=3&country=France is not working (using CURL in PHP).
I don’t understand why the response is a HTTP/1.1 400 Bad Request.
Trying 3.226.33.234:443…
- Connected to sportscore1.p.rapidapi.com (3.226.33.234) port 443 (#0)
- ALPN, offering http/1.1
- SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
- ALPN, server accepted to use http/1.1
- Server certificate:
- subject: CN=*.p.rapidapi.com
- start date: Jul 6 00:00:00 2022 GMT
- expire date: Aug 4 23:59:59 2023 GMT
- subjectAltName: host “sportscore1.p.rapidapi.com” matched cert’s “*.p.rapidapi.com”
- issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon
- SSL certificate verify ok.
POST /teams/search?sport_id=3&country=France HTTP/1.1
Host: sportscore1.p.rapidapi.com
Accept: /
Accept-Encoding: deflate, gzip, br
X-RapidAPI-Host: sportscore1.p.rapidapi.com
X-RapidAPI-Key: ****
- Mark bundle as not supporting multiuse
< HTTP/1.1 400 Bad Request
< Date: Wed, 17 Aug 2022 11:10:53 GMT
< Content-Type: text/plain; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-RateLimit-Requests-Limit: 500
< X-RateLimit-Requests-Remaining: 301
< X-RateLimit-Requests-Reset: 187629
< Server: RapidAPI-1.2.8
< X-RapidAPI-Version: 1.2.8
< X-RapidAPI-Region: AWS - us-east-1
< - Connection #0 to host sportscore1.p.rapidapi.com left intact
string(0) “”
Doe mee aan de discussie - voeg hieronder een opmerking toe
Log in / Schrij u in om nieuwe opmerkingen te plaatsen
ok!
OK I found the problem.
The example code is incorrect, the post data must be passed as a query string in the CURLOPT_POSTFIELDS field, not in the enpoint URL as suggested.