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. Quote
0 Blesta Addons Posted April 21, 2017 Report Posted April 21, 2017 On 4/20/2017 at 6: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. 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 . Quote
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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.