Skip to content

Commit 7411adf

Browse files
authored
Merge pull request #820 from wesmangum/patch-1
Make note about HTML-encoding Query Strings in Search Docs
2 parents bc544e7 + 1e5cdb6 commit 7411adf

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

content/rest/reference/search.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,21 @@ Each endpoint in the Search API uses [query parameters](https://en.wikipedia.org
3636
A query can contain any combination of search qualifiers supported on {% data variables.product.product_name %}. The format of the search query is:
3737

3838
```
39-
q=SEARCH_KEYWORD_1+SEARCH_KEYWORD_N+QUALIFIER_1+QUALIFIER_N
39+
SEARCH_KEYWORD_1 SEARCH_KEYWORD_N QUALIFIER_1 QUALIFIER_N
4040
```
4141

4242
For example, if you wanted to search for all _repositories_ owned by `defunkt` that
4343
contained the word `GitHub` and `Octocat` in the README file, you would use the
4444
following query with the _search repositories_ endpoint:
4545

4646
```
47-
q=GitHub+Octocat+in:readme+user:defunkt
47+
GitHub Octocat in:readme user:defunkt
48+
```
49+
50+
**Note:** Be sure to use your language's preferred HTML-encoder to construct your query strings. For example:
51+
```javascript
52+
// JavaScript
53+
const queryString = 'q=' + encodeURIComponent('GitHub Octocat in:readme user:defunkt');
4854
```
4955

5056
See "[Searching on GitHub](/articles/searching-on-github/)"

0 commit comments

Comments
 (0)