简体   繁体   中英

Retrieving POST request from outer application to Laravel: 419 unknown status

I am trying to send POST request from advanced REST client for Chrome to Laravel App:

在此处输入图片说明

I understand that Laravel has the protection from request like it, but what I need, for example, to update the database from some native application, like UWP? (Of course, I use advanced REST client for testing for now).

I tried Laravel JSON API . With below code, I retrieve error 419 unknown status (also, dump('done') has not been reached:

Route::post('api/update', function(){
  dump('done');
  $guzzleClient = new GuzzleHttp\Client(['base_uri' => 'http://example.loc/api/update/']);
  $client = json_api('v1')->client($guzzleClient);
});

What I missed? Please let me know WHERE I need to add code from your solution (controller, web.php etc.).

write in your api.php

Route::get('/update',function(){
    return response()->json("test");
});

and check with same url in rest client http://example.loc/api/update/ and see result

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM