Skip to main content

How to restore mysql database from cpanel api1 in console app

Comments

4 comments

  • cPanelMichael
    Hello :) Have you tried using the formulated URL in your browser to see if you get a similar result? Thank you.
    0
  • vietvoquoc
    I am very happy when you took the time to replied me! Thank for that. I did a request using on the browser like so: 1. I requested using api1 : http://:2086/cpsess7337161488/json-api/restoredb?api.version=1&dir=public_html/mydumbsqlfile.sql&file-1=file-chi4d960_testing
    And the result like this: {"cpanelresult":{"apiversion":"2","error":"Access denied","data":{"reason":"Access denied","result":"0"},"type":"text"}}
    Note: cpsess7337161488 i am using is session i get from cpanel console when i login with username and password in hosting. And i also made the call using whm like this: http://:2086/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_module=Fileman&cpanel_jsonapi_func=restoredb&cpanel_jsonapi_apiversion=1&arg-0=file-chi4d960_testing&arg-1=public_html/mydumbsqlfile.sql
    And result is the same: {"apiversion":"1","error":"Access denied","data":{"reason":"Access denied","result":"0"},"type":"text"}
    And this is result that server response when i request in console app .net with basic authentication ( Code in the first post ): {"apiversion":"1","type":"event","module":"Fileman","func":"restoredb","source":"module","data":{"result":""},"event":{"result":1}}
    i don't know where i am wrong and hope receive some help from you! Best regards! vietvoquoc,
    0
  • storminternet
    I am not seeing command to restore the sql database with appropriate path for sql file in your code. Not sure if it the problem but I will suggest you to check your code with the help of your developer.
    0
  • vietvoquoc
    Thanks for help me. From your suggestion with the path to sql file that using to restore my database. I chang code line in my method like this : string dir = "dir=/home/username/public_html/testing.sql"; I just post a parameter with value of path locate to dumb sql file that i use to restore database. i don't post any file content inside body of this request. Please take a look and give me some advice! Thanks. [COLOR="silver">- - - Updated - - - Sorry because i don't mention about result when i run this code. The changed code still response with the same result.
    0

Please sign in to leave a comment.