ovh/php-ovh

How to create and PUT a file on the Document endpoint ?

Tchanove opened this issue · 1 comments

Hi,

I'm having some trouble about the POST /me/document endpoint.

My use case is the following :

  • I want to provision a database with a dump from another database

If my understanding of the OVH Api is right, I need to do the following steps :

  • Create a dump from the database 1
    • Call POST /hosting/privateDatabase/MyService/database/DB1/dump
    • This is working fine
  • Download the dump
    • Call GET /hosting/privateDatabase/MyService/database/DB1/dump/xxxx
    • Retrieve the url field from the response
    • Call GET on the url
    • This is working fine
  • Create a document
    • Call POST /me/document
    • Retrieve the putUrl field from the response
    • Call that putUrl with a file content
    • Here is my problem : How should I call this url ? With the ovh/ovh api wrapper ? Or with a simple Curl call ?
    • How should I pass my file content to this call ?
  • Import the document in the database 2 :
    • Call POST /hosting/privateDatabase/MyService/database/DB2/import with the document ID created just before.

Maybe my workflow is wrong too and there is another / simpler way to provision a database with a dump from another database ?

Help ! ^^

Hello,
Sorry for the late answer.

This issue tracker is dedicated on problems with the php-ovh wrapper, please note that for every questions related to the API, you need to subscribe to the api-subscribe@ml.ovh.net, then, post your question to api@ml.ovh.net.

Regarding your question, a call to POST /me/document just return a putUrl as you said, and this URL is not related to the OVH API, so you don't need to use the php-ovh to call it. A simple cURL will work.
The content of the file should be sent directly in request body, with the correct header Content-Type set.

Thanks
Romain