How to use the POST method to send the copy request in yandex

There are some books in yandex-disk that is public.The disk link is here.I want to make get request to retrieve some data from it. I am using axios in react to make get request and my code is like that as yandex documentation mentioned.My question is how to find path and public key from that disk that is public.Also how to make right get request to retrieve data?

import './App.css';
const axios = require('axios');

function App() {
  // Make a request for a user with a given ID
  const path = '?';
  const publicKey = '?';

  axios
    .get(
      `https://cloud-api.yandex.net/v1/disk/public/resources/download?public_key=${publicKey}&path=${path}`
    )
    .then(function (response) {
      // handle success
      console.log(response);
    })
    .catch(function (error) {
      // handle error
      console.log(error);
    });

  return (
    <div className="App">
      <h1>Eksi Kitap</h1>
    </div>
  );
}

export default App;





Umm…disclaimer, I’m not an expert.

First of all, I don’t think that’s how you call a function. I don’t know Axios but I do know JS… I’m pretty sure you don’t use className to call a function. Also, this looks an awful lot like front end. API calls happen in the back end…

Second, seeing the documentation, it doesn’t appear as if the API calls require a publicKey. And this should be your path:

https://cloud-api.yandex.net/v1/disk/public/resources/download

I’d suggest using Postman to test your API calls. Just so you know what’s the right format and what kinds of responses you get in return.

I’m hoping I’m accurate but might be best to wait for someone better to come along…

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.