Consume API with mandatory parameters

0

If I have an API that requires two mandatory parameters to be consumed, how should I insert them into a $ http request?

self.buscaPrestadores = function()
{  
    $http({
            method: 'GET',
            url: self.urlPrestadores,
            headers: { 'Content-Type': 'application/json' }
            data: {'parametro1':abc,'parametro2':abc }
    }).then(function(resposta) { 
         var json = {};
         json = resposta.data.data;
         console.log(json);
    })
}

HowmuchdoItrytoconsumetheAPIofthefollowingmessageinthedeveloperguide:

    
asked by anonymous 06.10.2018 / 05:23

1 answer

0

Issue resolved:

GET parameters are sent via string in the url and need to send as a direct parameter in the url, in the case of $ http, the structure name is params and no data!

    
06.10.2018 / 21:53