msorri Posted April 20, 2017 Report Posted April 20, 2017 Hi. When I try to call the Packages\Edit function through the API, it fails with the following error: { "response": null, "error": { "name": { "empty": "Please enter a package name." }, "email_content[0][lang]": { "empty": "Please enter a language." }, "pricing[0][currency]": { "format": "Currency code must be 3 characters." } } } Here's my code which calls the API: public function deactivatePackage($id = null) { global $blestaapi; $response = $blestaapi->put("packages", "edit", array("package_id" => $id, "vars" => array("status" => "restricted"))); $responseParsed = array("response" => $response->response(), "error" => $response->errors()); return $responseParsed; } I'm quite confused, because it seems that I call the Packages\Add function because it complains about the missing options that are a optional in Packages\Edit but not in Packages\Add.
0 Blesta Addons Posted April 21, 2017 Report Posted April 21, 2017 On 4/20/2017 at 5:46 PM, msorri said: Hi. When I try to call the Packages\Edit function through the API, it fails with the following error: { "response": null, "error": { "name": { "empty": "Please enter a package name." }, "email_content[0][lang]": { "empty": "Please enter a language." }, "pricing[0][currency]": { "format": "Currency code must be 3 characters." } } } Here's my code which calls the API: public function deactivatePackage($id = null) { global $blestaapi; $response = $blestaapi->put("packages", "edit", array("package_id" => $id, "vars" => array("status" => "restricted"))); $responseParsed = array("response" => $response->response(), "error" => $response->errors()); return $responseParsed; } I'm quite confused, because it seems that I call the Packages\Add function because it complains about the missing options that are a optional in Packages\Edit but not in Packages\Add. Expand you have sent only the id of the package to edit fucntion, before you should get the package info via Packages.get() then send the data with the changed info you want edit .
Question
msorri
Hi.
When I try to call the Packages\Edit function through the API, it fails with the following error:
{ "response": null, "error": { "name": { "empty": "Please enter a package name." }, "email_content[0][lang]": { "empty": "Please enter a language." }, "pricing[0][currency]": { "format": "Currency code must be 3 characters." } } }
Here's my code which calls the API:
I'm quite confused, because it seems that I call the Packages\Add function because it complains about the missing options that are a optional in Packages\Edit but not in Packages\Add.
1 answer to this question
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now