S
S
Shenku2021-06-01 17:07:16
PHP
Shenku, 2021-06-01 17:07:16

Api Yandex.Delivery returns 504?

Actually code:

$data = array(
    'senderId' => 'ИД Магазина',
    'to' => array(
        'location' => 'Калининград, Ленина, 10',
        'geoId' => 22,
        'postalCode' => '236006'
    ),
    'dimensions' => array(
        'length' => 5,
        'width' => 3,
        'height' => 5,
        'weight' => 5.2
    )
);

$curl = curl_init();

curl_setopt( $curl, CURLOPT_URL, 'https://api.delivery.yandex.ru/delivery-options' );
curl_setopt( $curl, CURLOPT_PUT, true );
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $curl, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Authorization: OAuth Токен'
));

curl_setopt( $curl, CURLOPT_POSTFIELDS, json_encode( $data, JSON_UNESCAPED_UNICODE ) );

$output = curl_exec( $curl );

if ( $output === FALSE ) {

    echo 'cURL Error: ' . curl_error( $curl );
    return;

} else {
    echo $output;
}

curl_close( $curl );


Good day. We want to get the possible ways of delivery. Here is such a simple minimal request to the API returns 504, maybe someone has met with the new delivery api, share your experience.

The token is correct, we made a request to get the geoId, the store ID too, before that there was a widget on the site.
Yandex said, in short: "we do not give recommendations for PHP"

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question