@devansh-webkul
I added the command Log::info() on method __construct(CustomerAddressRepository $customerAddressRepository) of the app/bagisto/packages/Webkul/API/Http/Controllers/Shop/AddressControler.php to check if all data I sending to api addresses/create is arriving.
All data is arriving BUT the store() method is not executing...
If I run by postman the store() method is executed...
Do you have any ideia what I need to configure to execute correctly ?
Please, could you help me?
William Hatanaka
@William Hatanaka
Posts made by William Hatanaka
-
RE: api - I can create a address ...
-
RE: api - I can create a address ...
@devansh-webkul
I don't know if it is the right way to take a token...$client = new \GuzzleHttp\Client([ 'headers' => [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', ], ]); $response = $client->request('POST', config('global.ecsite.url').'/api/customer/login', [ 'query' => ['token'=>'true'], 'form_params' => $data ]); $responseData = json_decode($response->getBody(), true); $token=$responseData['token'];
I take the token in this last line after login ..
-
RE: api - I can create a address ...
@darkuser123
I did the following things:- I logged with a customer
$client = new \GuzzleHttp\Client([ 'headers' => [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', ], ]); $response = $client->request('POST', config('global.ecsite.url').'/api/customer/login', [ 'query' => ['token'=>'true'], 'form_params' => $data ]); $responseData = json_decode($response->getBody(), true); $token=$responseData['token'];
And after that I filled a array with the address data.
$data=[ 'address1' => ['Clock Tower'], 'city' => 'Dehradun', 'country' => 'IN', 'country_name' => 'India', 'phone' => '24833333001', 'postcode' => '222222', 'state' => 'UT', ]; $client = new \GuzzleHttp\Client([ 'headers' => [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', 'Authorization' => 'Bearer '.$token, ], ]); $response = $client->request('POST', config('global.ecsite.url').'/api/addresses/create', [ 'form_params' => $data, ]);
But the response value is
Client error: `POST https://shop.whatanaka.com/api/addresses/create` resulted in a `401 Unauthorized` response: {"error":"Unauthenticated"}
What am I doing wrong? Could you help me, please?
-
RE: api - I can create a address ...
Hello, @devansh-webkul
But how can I do on Laravel?
I developed another system in Laravel thar consume Bagisto API, so I need to create a address on Bagisto E-commerce system throghout this another system in Laravel .
I am using Guzzle like this...$response = $client->request('POST', config('global.ecsite.url').'/api/addresses/create', [ 'form_params' => [ 'address1'=>[$member->address], 'city'=>$member->city, 'country'=>'JP', 'country_name'=>'Japan', 'phone'=>$member->fixed_phone, 'postcode'=>$member->zipcode, 'state'=>$member->prefecture, ]
and the response value is:
'Client error: `POST https://shop.mysite.com/api/addresses/create` resulted in a `401 Unauthorized` response: {"error":"Unauthenticated"} ',
Could you help me please?
-
RE: api - I can create a address ...
@devansh-webkul
It's worked! Tahnk you very much !!! -
RE: [API] Can not get Get Customer’s Information using API
Hello, @yomnademerdash
Did you manage to solve your problem? If so, could you tell me how you managed to solve it? I have the same problem. -
api - I can create a address ...
I following the https://devdocs.bagisto.com/1.x/api/addresses.html#create-a-new-address example, but I no have success... For tests I am using the the Postman.
The version of Bagisto is v1.1.0 (24th of March 2020)
I can login adding the [?token=true] to [api/customer/login] .
After that I try to create a address for this customer and the error 500 Internal Server Error occurs.
I try to create mannally the address and read it by api using GET <host>/api/addresses and I can get it !!!
But I can create and update...
Somebody could help me please?
-
RE: Bagisto Web Api - Customers Registration
@vishalK ,
Thank you very much!
I will try! -
RE: Bagisto Web Api - Customers Registration
@vishalK,
Thank you for your quick reply !
But could you tell me where I can make this customization? Or rather, what is the source where I can do it? I am not very familiar with Bagisto yet, but I really need to do it. I chose Bagisto because of this api feature, but I didn't know I wouldn't be able to do this complete update on the customer profile.
Thanks a lot. -
Bagisto Web Api - Customers Registration
Hello,
I am using Bagisto v.1.1.2 and I am able to register customers in Bagistro through api-customer registration without problems.
Besides the fields email, first_name, last_name, password, password_confirmation I also need to register the group to which this customer belongs.
I tried to add the "group" field to the list of parameters with the corresponding "id" value but the registered user is still in the "general" group.
Could you advise me how to do this?
Thank you very much.