S
S
shaman3602020-07-27 18:13:10
PHP
shaman360, 2020-07-27 18:13:10

Need help with rest api for cloud mail.ru?

I use the Cloud Mail.ru service for storing files.
After reading a rather meager help on how to form a REST API, I was left with a few questions.
Maybe someone already had experience with REST for mail.ru and he successfully mastered it? After contacting the support service, the question of generating the Authorization

key is still open . But from generally accepted standards, I form it as EMAIL and PASSWORD (through a colon). In a task, I need to delete a file from a bucket using the DELETE command. With the example below. i get an AccessDenied message.


$url = 'https://BACKET_NAME.hb.bizmrg.com/file.zip';
$date = date(DATE_RFC822);
$array = array
    (
      'Host'=>'BACKET_NAME.hb.bizmrg.com',
      'Date'=>$date,
      'Connection'=>'close',
      'Content-Length'=>'length',
      'Authorization'=>'EMAIL:PASSWORD',
    );
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_HTTPHEADER, $array);
echo curl_exec($ch);

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dimonchik, 2020-07-27
@dimonchik2013

the question of generating the Authorization key remained open. But from generally accepted standards, I form it as EMAIL and PASSWORD (through a colon)

bad method
, does it allow you to do anything? Where is the API link?

N
nokimaro, 2020-07-27
@nokimaro

Mail cloud storage provides a protocol that is fully compatible with the S3 API.
To work, you can use any S3 client https://mcs.mail.ru/help/sdk/php?kb_language=ru_RU

V
vitaly_74, 2020-07-27
@vitaly_74

if you are using Basic authorization then

"Authorization: Basic " .  base64_encode("EMAIL:PASSWORD")

but you didn't send a link to the documentation, I don't know what is used there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question