Consume API with JQuery and save to database

0

Good evening! I'm trying to consume an API using JQuery and Laravel. I created the route to access and save the data, access always returns me with status 0.

web.php:

Route::any('http://moviecom.com.br/MoviecomAPI/','MoviecomController@store')->name('movieAPI');

In the view I put the code javascript:

$.ajax({
                headers: {
                    'user_token': '',
                },
                type: 'GET',
                dataType: "json",
                url: "{{!! URL::to('http://moviecom.com.br/MoviecomAPI/') !!}}",
                data: {
                    'praca': 'JU2',
                    'data_ini': '2018-05-10',
                    'data_fim': '2018-05-20'
                },
                success: function(response) {
                    console.log(response);

                    if(response.status == "Success") {
                        $(response.data[0].filmes).each( function(i, el) {

                            // Pegar os dados e salvar no banco
                        })
                    }
                    else {
                        console.log(response.data[0]);
                    }   
                }

I am using the token correctly and in the api documentation it says nothing about.

    
asked by anonymous 12.05.2018 / 07:56

0 answers