Category : http

I’m able to do the delete method, but I’m getting 405 (Method Not Allowed) error, any idea on how to handle this error? The API was made with laravel async deletaPessoa() { await fetch("http://127.0.0.1:8000/api/pessoas/" + this.idPessoa, { method: "delete", headers: { "Content-type": "application/json" }, }) } (The command works fine, but I get this message) ..

Read more

I am attempting to add a custom header within a Laravel(8) response called X-Custom which works, but it places it at the top of the header stack as such: HTTP/1.1 200 OK Date: Mon, 01 Nov 2021 10:58:44 GMT Server: Apache/2.4.29 (Ubuntu) X-Custom: 8675309 Cache-Control: no-cache, private X-RateLimit-Limit: 60 X-RateLimit-Remaining: 59 Access-Control-Allow-Origin: * Content-Length: 13 ..

Read more

I have a Laravel controller that retrieves binary image data from some source like the database or an API and returns it as the response: class ExampleController extends Controller { // … public function testImage(Request $request) { $binaryImageData = $this->repository->getImage($request->query); return response($binaryImageData); } } However since Laravel returns a Content-Type header value of `text/html’ when ..

Read more

i’m figuring how to use CORS in laravel 8. My local website is located at http://127.0.0.1:8000 and I want to send request to https://translate.googleapis.com but, I always get this error : Access to fetch at ‘https://translate.googleapis.com/translate_a/single?client=gtx&sl=id&tl=en&dt=t&q=%20rapat%20kelas%20a%20membicarakan%20tentang%20kemajuan%20smp%20kunugigaoka’ from origin ‘http://127.0.0.1:8000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If ..

Read more

public static function send() { $products = Product::where(‘active’, 1)->get([‘id_product’, ‘price’, ‘reference’])->load([‘images’, ‘lang’]); // loop for all products and sending to API $number_of_products = count($products); $start = 0; $end = 70; for ($a = 0; $a < ceil($number_of_products/70); $a++) { for ($i = $start; $i < $end; $i++) { // loop for all images in product ..

Read more

I am preparing a common and current CRUD-type REST API with the users model that laravel brings by default <?php namespace AppModels; use LaravelSanctumHasApiTokens; use IlluminateNotificationsNotifiable; use IlluminateContractsAuthMustVerifyEmail; use IlluminateDatabaseEloquentFactoriesHasFactory; use IlluminateFoundationAuthUser as Authenticatable; use IlluminateAuthPasswordsCanResetPassword; class User extends Authenticatable implements MustVerifyEmail { use HasApiTokens, HasFactory, Notifiable, CanResetPassword; /** * The attributes that are mass ..

Read more

Buenos dias Developers hoy me encuentro en una situaciĆ³n anteriormente ya habia usado livewire de laravel para mis proyectos pero no me habia enfrentado a esto tengo un dominio de un sistema en operacion me solicitaron mejoras e implemente livewire sabemos que para publicar los assets de livewire se debe publicar los archivos con php ..

Read more

I am creating a user with the api provided. I am using Laravel and trying to store data to smartrmail and docs to create new subscriber is here https://docs.smartrmail.com/en/articles/636615-list-subscribers Each time i send request i get following error: Server error: `POST https://go.smartrmail.com/api/v1/lists/1sptso/list_subscribers` resulted in a `500 Internal Server Error` response: {"error":"param is missing or the ..

Read more

Update: Am I reading the MDN docs right? The Set-Cookie is forbbiden as response header? Then how am I supposed to make Laravel Sanctum set the XSRF token cookie? https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie : Warning: Browsers block frontend JavaScript code from accessing the Set Cookie header, as required by the Fetch spec, which defines Set-Cookie as a forbidden ..

Read more

This is the our list service api. POST /createList /start process to create list. Return listId/ GET /checkList/listId /returns status of the list. Processing, completed etc/ GET /getList/idlistId /if status completed return payload/ Do while or cron job can be used as a solution. But I am looking for the most optimal solution that can ..

Read more

I’m currently working on a project where i got stuck on connecting Laravel 8 with Flutter. When I run the API normal inside Postman, everything works perfectly once I try it inside Flutter i got the follow error. Unhandled Exception: SocketException: OS Error: Connection refused, errno = 111, address = [IP Address Server], port = ..

Read more

I’m trying to make a post http request using IlluminateSupportFacadesHttp. My request : $response = Http::post( $this->api.’/auth’, [ ‘auth’ => [ ‘username’ => $this->username, ‘password’ => $this->password ] ] )->json(‘response’); While api,username and password are set in a __construct method. This request is working well in postman. But when I run it on php server ..

Read more

I am trying to replicate tinyurl functionality. Here is the flow of the application: URL Route: abc.com/{id} – there is a URL in the database against the ID. Route::get(‘/{id}’, [AppHttpControllersController::class, ‘direct’]); Controller: Receiving the route request, following actions are being performed in the controller: public function direct($id) { $link = Link::where(DB::raw(‘BINARY `slug`’),’=’,$id)->where(‘status’,’=’,1)->firstOrFail(); $url = $link->url; ..

Read more

I am working in a Vue app with a Laravel api and I am getting exactly what it says in the title. My Axios call: return await axios.post("/customers/load-cart-data", payload); Inside the general section of my network tab: Request Method: POST What I get back from our api: "message": "The GET method is not supported for ..

Read more