I need to filter data from a search, but when passing a string to the refinementfilter an error occurs.


When I pass the parameters without the space character, for example, the query returns the results normally. However, when I pass the parameter with the space character the error occurs

My request:

        type: "GET",
        url: url + "/_api/search/query?querytext='teste'&startrow=0&rowlimit=100&selectproperties='Url,Title,Filename,AreaAtuacao,tipoConteudo,Created,ContentType'&sourceid='e1327b9c-2b8c-4b23-99c9-3730cb29c3f7'&refinementfilters='and(SPContentType:equals('Publicação'),AreaAtuacao:('Institucional'),TipoConteudo:('Artigos'))'",
            headers: {
            Accept: "application/json;odata=verbose",
            "X-RequestDigest": $('#__REQUESTDIGEST').val()
            success: function (dados) {

1 Answer 1


You will need to URL encode your string in order to use it in your AJAX request. To encode the value in JavaScript, you can use encodeURIComponent()


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.