{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":42582,"path":"platform-user-interface/service-portal/search-sp-advanced.md","title":null,"bundle":null,"doc_type":null,"release":null,"body":"---\ntitle: Example: set up a GitHub search source\ndescription: Set up an advanced search source that queries data from an external website.\nlocale: en-US\ncanonical_url: https://www.servicenow.com/docs/r/australia/platform-user-interface/service-portal/search-sp-advanced.html\nrelease: australia\nproduct: Service Portal\nclassification: service-portal\ntopic_type: task\nlast_updated: \"2026-03-12\"\nreading_time_minutes: 1\nbreadcrumb: [Define a search source, Zing search in Service Portal, Configuring search in a portal, Configuring Service Portal, Service Portal, Configure UIs and portals, Configure user experiences]\n---\n\n# Example: set up a GitHub search source\n\nSet up an advanced search source that queries data from an external website.\n\n## Before you begin\n\nRole required: none\n\nTo create an advanced search source, you need authenticated access to an external website via a REST API and basic knowledge of [AngularJS](https://angularjs.org/).\n\n## Procedure\n\n1.  In the platform UI, navigate to **Service Portal** &gt; **Portals** and select the portal you want to add search sources to.\n\n2.  From the Search Sources related list, click **New**.\n\n3.  Create a name and ID for the search source.\n\n    The ID should be unique, and should not include any spaces or special characters.\n\n4.  On the **Data Source** tab, select the **Is scripted source** check box.\n\n5.  Add content to the data fetch script field.\n\n    To set up a GitHub integration:\n\n    ```\n    (function(query) {\n        var results = [];\n        /* Calculate your results here. */\n        var url = \"https://api.github.com/search/repositories?q=\" + encodeURI(query);\n        var ws = new GlideHTTPRequest(url);\n        ws.setBasicAuth(\"YOUR_USERNAME_HERE\", \"YOUR_PASSWORD_HERE\");\n        var jsonOutput = ws.get();\n        if (jsonOutput) {\n            var response = new JSON().decode(jsonOutput.getBody());\n            results = response.items;\n            results.forEach(function(result) {\n                result.url = result.svn_url;\n                result.target = \"_blank\";\n                result.primary = result.full_name;\n            });\n        }\n    \n        return results;\n    })(query);\n    ```\n\n    **Note:** In the preceding example, `ws.setBasicAuth` requires a username and password for the external resource. For more detail, see GlideHTTPRequest - Global.\n\n6.  Use the Search page template to customize the way the search results display.\n\n    ```\n    <div>\n      <div class=\"pull-right\">\n        <strong>{{item.language}}</strong>\n        <a ng-href=\"{{item.svn_url}}/stargazers\" target=\"_blank\" class=\"m-l-sm\"><span class=\"fa fa-star m-r-xs\"></span>{{item.stargazers_count}}</a>\n        <a ng-href=\"{{item.svn_url}}/network\" target=\"_blank\" class=\"m-l-sm\"><span class=\"fa fa-code-fork m-r-xs\"></span>{{item.forks}}</a>\n      </div>\n      <a ng-href=\"{{item.svn_url}}\" target=\"_blank\" class=\"h4 text-primary m-b-sm block\">\n        <span ng-bind-html=\"highlight(item.full_name, data.q)\"></span>\n      </a>\n      <p>{{item.description}}</p>\n      <p>Updated <sn-time-ago timestamp=\"item.updated_at\"></sn-time-ago> ago</p>\n    </div>\n    ```\n\n\n**Parent Topic:**[Define a search source](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-user-interface/service-portal/add-table-search-source.md)\n\n"}}