rezarahiminia / free-api-worldcup2022

Grab your football API data for FIFA World Cup 2022 competition!
239 stars 35 forks source link

Not Getting data for fixtures by date #135

Closed oyeleyemustapha closed 1 year ago

oyeleyemustapha commented 1 year ago

We currently use the api to get matches per day until recently we noticed we are not getting data for fixtures by date anymore.

PeppoDev commented 1 year ago

Seems to be a unexpected response when you don't send the Content-type: application/json inside the header.

If we are working on node should be something like:

const axios = require('axios');

const response = await axios.post(
    'http://api.cup2022.ir/api/v1/bydate',
    {
        'date': '12/2/2022'
    },
    {
        headers: {
            'Authorization': 'Bearer {your_token_goes_here}',
            'Content-Type': 'application/json'
        }
    }
);

We can use the curl version in order to convert to other language as you wish in this site

oyeleyemustapha commented 1 year ago

The Content-Type was added to the header when making the calls yet we don't get response for matches based on date.

<?php

$curl = curl_init();

curl_setopt_array($curl, array( CURLOPT_URL => 'http://api.cup2022.ir/api/v1/bydate', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS =>'{ "date": "12/06/2022" }', CURLOPT_HTTPHEADER => array( ': ', 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MzdjNGFkODQ4NzA5MjMzZmQ4NWM3OGYiLCJpYXQiOjE2NzA0MTQ1NzAsImV4cCI6MTY3MDUwMDk3MH0.V9yY7CxuptQKgRBaMlDGiz8zRLYc2cOlW8r0P-0uKkc', 'Content-Type: application/json' ), ));

$response = curl_exec($curl);

curl_close($curl); echo $response;

rezarahiminia commented 1 year ago

{ "date":"12/6/2022" }

On Wed, Dec 7, 2022 at 3:35 PM Mustapha oyeleye @.***> wrote:

The Content-Type was added to the header when making the calls yet we don't get response for matches based on date. 'http://api.cup2022.ir/api/v1/bydate', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS =>'{ "date": "12/06/2022" }', CURLOPT_HTTPHEADER => array( ': ', 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MzdjNGFkODQ4NzA5MjMzZmQ4NWM3OGYiLCJpYXQiOjE2NzA0MTQ1NzAsImV4cCI6MTY3MDUwMDk3MH0.V9yY7CxuptQKgRBaMlDGiz8zRLYc2cOlW8r0P-0uKkc', 'Content-Type: application/json' ), )); $response = curl_exec($curl); curl_close($curl); echo $response;

— Reply to this email directly, view it on GitHub https://github.com/raminmr/free-api-worldcup2022/issues/135#issuecomment-1340871387, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC4WPQQH46CGQPOTXHYKHGLWMB4R7ANCNFSM6AAAAAASVPF3GM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

--

Kind regards Reza Rahiminia

oyeleyemustapha commented 1 year ago

not getting any data for { "date":"12/7/2022" }

rezarahiminia commented 1 year ago

On the 7th and 8th, the game will not be played at all

On Wed, Dec 7, 2022 at 6:10 PM Mustapha oyeleye @.***> wrote:

not getting any data for { "date":"12/7/2022" }

— Reply to this email directly, view it on GitHub https://github.com/raminmr/free-api-worldcup2022/issues/135#issuecomment-1341065436, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC4WPQXHRBIIXQQ7QPWOJPLWMCOXBANCNFSM6AAAAAASVPF3GM . You are receiving this because you commented.Message ID: @.***>

--

Kind regards Reza Rahiminia

oyeleyemustapha commented 1 year ago

Thank you for yout help.