1

I'm creating a type-ahead People search using HTML, JS, AngularJS against the REST endpoint for SharePoint Server 2013 Search API.

My specific issue is in my resource definition.

The pattern the SharePoint search query I am using contains a colon (:):

.../_api/search/query?querytext=%27John+AND+Memberships:GRP-InformationSystems%27&sourceid=%27B09A7990-05EA-4AF9-81EF-EDFAB16C4E31%27

Here is the implementation of the service:

var searchService = servicesMod.factory('searchPeople', ['$resource',
    function ($resource) {
        return $resource('http://teamsint/_api/search/query?querytext=%27:searchText+AND+Memberships:GRP-InformationSystems%27&sourceid=%27B09A7990-05EA-4AF9-81EF-EDFAB16C4E31%27', { 'searchText': '@@searchText' }, {
            query: { method: 'GET', isArray: false, withCredentials: true },
        });
    }]);

... and angularjs is misidentifying it as a parameter and removing it from the resource URL.

and the request hits the server like this:

http://mysharepointserver/_api/search/query?querytext=%27John+AND+Memberships:-InformationSystems%27&sourceid=%27B09A7990-05EA-4AF9-81EF-EDFAB16C4E31%27

":GRP" which is part of the search query is being parsed out of the URL.

Is there a way to escape the colon so it is ignored in this case?

Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.