java - CS CART API Login Post URL

There is an auth attribute having 2 parameters, but it didn't work

http://example.com/api/auth?email=example@gmail.com

The output of the URL is

{
    "message": "Method Not Allowed: Missing parameters",
    "status": 405
}

Also, the redirection_url parameter is not working.

Please help me fix this.

Answer

Solution:

You need to provide

  1. Auth Email
  2. Auth Password

in Basic Oth in Postman

Answer

Solution:

How do your make this call, via CURL I guesss?

You need to provide user's email and API KEY generated for this user, base64 encoded.

For example you could have:

$user = "test@example.com";
$api = "api_generated_through_edit_user";

$base64 = base64_encode($user.":".$api);

having this piece of code, you could add it to the CURLOPT_HTTPHEADER of your CURL request, like so:

...
...
CURLOPT_HTTPHEADER => array(
                "Authorization: Basic " $base64 ,
                "Content-Type: application/json",
                "cache-control: no-cache"
            ),
...
...

You may also want to take a look here: https://forum.cs-cart.com/topic/55511-update-product-via-rest-api/

Last but not least, where do you want to make the redirect? For eaxmple, you could have sothing like this:

return array(CONTROLLER_STATUS_OK, "products.manage");

Source