Jump to content

Question

Posted

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.

1 answer to this question

Recommended Posts

  • 0
Posted
  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 .

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...