Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
Make a GET request after POST request is passed sucessfully with Laravel?

I am trying to make a file upload system on AWS based on laravel with ajax. I am talking about a resume parser system where i used the apilayer API to parse the CV from pdf to json.

I tried to make a file upload system where files are uploaded to aws (this works) and after i get the uploaded file url to send to API.

      public function store(Request $request)
    {
        $request->validate([
            'file' => 'required|mimes:doc,docx,pdf|max:2048',
        ]);

        $fileName = time() . '.' . $request->file->extension();
        $path = $request->file->storeAs('file', $fileName, 's3');
        CVupload::create(['name' => $fileName]);
        $urlcv = Storage::disk('s3')->url($path);
        return response()->json("$urlcv");
        }
}

Everything is ok, but when the API is executed from the below code i receive the error:

Client error: POST https://api.apilayer.com/resume_parser/url?url=https://--.s3.eu-central-1.amazonaws.com/file/-- resulted in a 403 Forbidden response:{"message":"You cannot consume this service"}

I see that the request is POST, and i have to make a GET REQUEST. Maybe its an error in Ajax Script?

<script type="text/javascript">
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')

        }
    });
    $('#file-upload').submit(function(e) {
        e.preventDefault();
        let formData = new FormData(this);
        $('#file-input-error').text('');
        $.ajax({
            type: 'POST',
            url: "{{ route('resume.store') }}",
            data: formData,
            contentType: false,
            processData: false,
            success: (response) => {
                if (response) {
                    this.reset();
                    $("#showResponseArea span").html(response); //you will paste your response msg to the 
                    $.ajax({
                        type: 'GET',
                        url: "{{ route('resume.api') }}",
                        dataType: 'json',
                        data: {
                            'url': response,
                        }
                    })
                }
            },
            error: function(response) {
                $('#file-input-error').text(response.responseJSON.message);
            }
        });
    });
</script>

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!