forked from github/developer.github.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1149 lines (1035 loc) · 71.1 KB
/
Copy pathindex.html
File metadata and controls
1149 lines (1035 loc) · 71.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="imagetoolbar" content="false" />
<meta name="MSSmartTagsPreventParsing" content="true" />
<title>Search | GitHub API</title>
<link rel="alternate" type="application/atom+xml" title="API Changes" href="/changes.atom" />
<link href="/css/reset.css" rel="stylesheet" type="text/css" />
<link href="/css/960.css" rel="stylesheet" type="text/css" />
<link href="/css/uv_active4d.css" rel="stylesheet" type="text/css" />
<link href="/shared/css/documentation.css" media="screen" rel="stylesheet" type="text/css">
<link href="/shared/css/pygments.css" media="screen" rel="stylesheet" type="text/css">
<script src="/shared/js/jquery.js" type="text/javascript"></script>
<script src="/shared/js/documentation.js" type="text/javascript"></script>
</head>
<body class="api">
<div id="header-wrapper">
<div id="header">
<div>
<a class="logo" href="/">GitHub:Developer</a>
<ul class="nav">
<li><a href="/" class="nav-overview">Overview</a></li>
<li><a href="/v3/" class="nav-api">API</a></li>
<li><a href="/changes/" class="nav-blog">Blog</a></li>
<li><a href="https://github.com/contact">Support</a></li>
<li id="search-container">
<input type="text" id="searchfield" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" /><label class="search-placeholder">Search</label>
<div class="cancel-search"></div>
<ul id="search-results">
</ul>
</li>
</ul>
</div>
</div><!-- #header -->
</div><!-- #header-wrapper -->
<div class="sub-nav">
<h2><a href="/v3/">API</a></h2>
<ul>
<li><a href="/v3/" class="active">Documentation</a></li>
<li><a href="/guides/">Guides</a></li>
<li><a href="/libraries/">Libraries</a></li>
</ul>
</div>
<div id="wrapper">
<div class="content">
<h1 id="search">Search</h1>
<ul id="markdown-toc">
<li><a href="#search-repositories">Search repositories</a></li>
<li><a href="#search-code">Search code</a></li>
<li><a href="#search-issues">Search issues</a></li>
<li><a href="#search-users">Search users</a></li>
<li><a href="#text-match-metadata">Text match metadata</a></li>
</ul>
<h3 id="about-the-search-api">About the Search API</h3>
<p>The Search API is optimized to help you find the specific item you’re looking
for (e.g., a specific user, a specific file in a repository, etc.). Think of it
the way you think of performing a search on Google. It’s designed to help you
find the one result you’re looking for (or maybe the few results you’re looking
for). Just like searching on Google, you sometimes want to see a few pages of
search results so that you can find the item that best meets your needs. To
satisfy that need, the GitHub Search API provides <strong>up to 1,000 results for each
search</strong>.</p>
<h3 id="rate-limit">Rate limit</h3>
<p>The Search API has a custom rate limit. For requests using <a href="/v3/#authentication">Basic
Authentication</a>, <a href="/v3/#authentication">OAuth</a>, or <a href="/v3/#unauthenticated-rate-limited-requests">client
ID and secret</a>, you can make up to
20 requests per minute. For unauthenticated requests, the rate limit allows you
to make up to 5 requests per minute.</p>
<p>See the <a href="/v3/#rate-limiting">rate limit documentation</a> for details on
determining your current rate limit status.</p>
<h2 id="search-repositories">Search repositories</h2>
<p>Find repositories via various criteria. This method returns up to 100 results <a href="/v3/#pagination">per page</a>.</p>
<pre><code>GET /search/repositories
</code></pre>
<h3 id="parameters">Parameters</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>q</code></td>
<td><code>string</code></td>
<td>The search keywords, as well as any qualifiers.</td>
</tr>
<tr>
<td><code>sort</code></td>
<td><code>string</code></td>
<td>The sort field. One of <code>stars</code>, <code>forks</code>, or <code>updated</code>. Default: results are sorted by best match.</td>
</tr>
<tr>
<td><code>order</code></td>
<td><code>string</code></td>
<td>The sort order if <code>sort</code> parameter is provided. One of <code>asc</code> or <code>desc</code>. Default: <code>desc</code>
</td>
</tr>
</tbody>
</table>
<p>The <code>q</code> search term can also contain any combination of the supported repository search qualifiers:</p>
<ul>
<li>
<a href="https://help.github.com/articles/searching-repositories#search-in"><code>in</code></a>
Qualifies which fields are searched. With this qualifier you can restrict the
search to just the repository name, description, readme, or
any combination of these.</li>
<li>
<a href="https://help.github.com/articles/searching-repositories#size"><code>size</code></a>
Finds repositories that match a certain size (in kilobytes).</li>
<li>
<a href="https://help.github.com/articles/searching-repositories#forks"><code>forks</code></a>
Filters repositories based on the number of forks, and/or whether forked repositories should be included in the results at all.</li>
<li>
<a href="https://help.github.com/articles/searching-repositories#created-and-last-updated"><code>created</code> or <code>pushed</code></a>
Filters repositories based on times of creation, or when they were last updated.</li>
<li>
<a href="https://help.github.com/articles/searching-repositories#users-organizations-and-repositories"><code>user</code> or <code>repo</code></a>
Limits searches to a specific user or repository.</li>
<li>
<a href="https://help.github.com/articles/searching-repositories#languages"><code>language</code></a>
Searches repositories based on the language they’re written in.</li>
<li>
<a href="https://help.github.com/articles/searching-repositories#stars"><code>stars</code></a>
Searches repositories based on the number of stars.</li>
</ul>
<h4 id="repository-search-example">Example</h4>
<p>Suppose you want to search for popular Tetris repositories written in Assembly.
Your query might look like this.</p>
<pre><code>https://api.github.com/search/repositories?q=tetris+language:assembly&sort=stars&order=desc
</code></pre>
<p>In this request, we’re searching for repositories with the word <code>tetris</code> in the
name, the description, or the README. We’re limiting the results to only find
repositories where the primary language is Assembly. We’re sorting by stars in
descending order, so that the most popular repositories appear first in the
search results.</p>
<pre class="headers"><code>Status: 200 OK
X-RateLimit-Limit: 20
X-RateLimit-Remaining: 19</code></pre>
<pre><code class="language-javascript"><span class="p">{</span>
<span class="s2">"total_count"</span><span class="o">:</span> <span class="mi">40</span><span class="p">,</span>
<span class="s2">"items"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"id"</span><span class="o">:</span> <span class="mi">3081286</span><span class="p">,</span>
<span class="s2">"name"</span><span class="o">:</span> <span class="s2">"Tetris"</span><span class="p">,</span>
<span class="s2">"full_name"</span><span class="o">:</span> <span class="s2">"dtrupenn/Tetris"</span><span class="p">,</span>
<span class="s2">"owner"</span><span class="o">:</span> <span class="p">{</span>
<span class="s2">"login"</span><span class="o">:</span> <span class="s2">"dtrupenn"</span><span class="p">,</span>
<span class="s2">"id"</span><span class="o">:</span> <span class="mi">872147</span><span class="p">,</span>
<span class="s2">"avatar_url"</span><span class="o">:</span> <span class="s2">"https://secure.gravatar.com/avatar/e7956084e75f239de85d3a31bc172ace?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"</span><span class="p">,</span>
<span class="s2">"gravatar_id"</span><span class="o">:</span> <span class="s2">"e7956084e75f239de85d3a31bc172ace"</span><span class="p">,</span>
<span class="s2">"url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/dtrupenn"</span><span class="p">,</span>
<span class="s2">"received_events_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/dtrupenn/received_events"</span><span class="p">,</span>
<span class="s2">"type"</span><span class="o">:</span> <span class="s2">"User"</span>
<span class="p">},</span>
<span class="s2">"private"</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span>
<span class="s2">"html_url"</span><span class="o">:</span> <span class="s2">"https://github.com/dtrupenn/Tetris"</span><span class="p">,</span>
<span class="s2">"description"</span><span class="o">:</span> <span class="s2">"A C implementation of Tetris using Pennsim through LC4"</span><span class="p">,</span>
<span class="s2">"fork"</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span>
<span class="s2">"url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/dtrupenn/Tetris"</span><span class="p">,</span>
<span class="s2">"created_at"</span><span class="o">:</span> <span class="s2">"2012-01-01T00:31:50Z"</span><span class="p">,</span>
<span class="s2">"updated_at"</span><span class="o">:</span> <span class="s2">"2013-01-05T17:58:47Z"</span><span class="p">,</span>
<span class="s2">"pushed_at"</span><span class="o">:</span> <span class="s2">"2012-01-01T00:37:02Z"</span><span class="p">,</span>
<span class="s2">"homepage"</span><span class="o">:</span> <span class="s2">""</span><span class="p">,</span>
<span class="s2">"size"</span><span class="o">:</span> <span class="mi">524</span><span class="p">,</span>
<span class="s2">"stargazers_count"</span><span class="o">:</span> <span class="mi">1</span><span class="p">,</span>
<span class="s2">"watchers_count"</span><span class="o">:</span> <span class="mi">1</span><span class="p">,</span>
<span class="s2">"language"</span><span class="o">:</span> <span class="s2">"Assembly"</span><span class="p">,</span>
<span class="s2">"forks_count"</span><span class="o">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">"open_issues_count"</span><span class="o">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">"master_branch"</span><span class="o">:</span> <span class="s2">"master"</span><span class="p">,</span>
<span class="s2">"default_branch"</span><span class="o">:</span> <span class="s2">"master"</span><span class="p">,</span>
<span class="s2">"score"</span><span class="o">:</span> <span class="mf">10.309712</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span></code></pre>
<h3 id="highlighting-repository-search-results">Highlighting Repository Search Results</h3>
<p>Some API consumers will want to highlight the matching search terms when
displaying search results. The API offers additional metadata to support this
use case. To get this metadata in your search results, specify the <code>text-match</code>
media type in your Accept header. For example, via curl, the above query would
look like this:</p>
<pre><code>curl -H 'Accept: application/vnd.github.v3.text-match+json' \
https://api.github.com/search/repositories?q=tetris+language:assembly&sort=stars&order=desc
</code></pre>
<p>This produces the same JSON payload as above, with an extra key called
<code>text_matches</code>, an array of objects. These objects provide information such as
the position of your search terms within the text, as well as the property that
included the search term.</p>
<p>When searching for repositories, you can get text match metadata for the
<strong>name</strong> and <strong>description</strong> fields. (See the section on <a href="#text-match-metadata">text match metadata
</a> for full details.)</p>
<p>Here’s an example response:</p>
<pre><code class="language-javascript"><span class="p">{</span>
<span class="s2">"text_matches"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"object_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repositories/3081286"</span><span class="p">,</span>
<span class="s2">"object_type"</span><span class="o">:</span> <span class="s2">"Repository"</span><span class="p">,</span>
<span class="s2">"property"</span><span class="o">:</span> <span class="s2">"name"</span><span class="p">,</span>
<span class="s2">"fragment"</span><span class="o">:</span> <span class="s2">"Tetris"</span><span class="p">,</span>
<span class="s2">"matches"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"text"</span><span class="o">:</span> <span class="s2">"Tetris"</span><span class="p">,</span>
<span class="s2">"indices"</span><span class="o">:</span> <span class="p">[</span>
<span class="mi">0</span><span class="p">,</span>
<span class="mi">6</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="s2">"object_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repositories/3081286"</span><span class="p">,</span>
<span class="s2">"object_type"</span><span class="o">:</span> <span class="s2">"Repository"</span><span class="p">,</span>
<span class="s2">"property"</span><span class="o">:</span> <span class="s2">"description"</span><span class="p">,</span>
<span class="s2">"fragment"</span><span class="o">:</span> <span class="s2">"A C implementation of Tetris using Pennsim through LC4"</span><span class="p">,</span>
<span class="s2">"matches"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"text"</span><span class="o">:</span> <span class="s2">"Tetris"</span><span class="p">,</span>
<span class="s2">"indices"</span><span class="o">:</span> <span class="p">[</span>
<span class="mi">22</span><span class="p">,</span>
<span class="mi">28</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span></code></pre>
<h2 id="search-code">Search code</h2>
<p>Find file contents via various criteria. (This method returns up to 100 results <a href="/v3/#pagination">per page</a>.)</p>
<pre><code>GET /search/code
</code></pre>
<h3 id="parameters-1">Parameters</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>q</code></td>
<td><code>string</code></td>
<td>The search terms.</td>
</tr>
<tr>
<td><code>sort</code></td>
<td><code>string</code></td>
<td>The sort field. Can only be <code>indexed</code>, which indicates how recently a file has been indexed by the GitHub search infrastructure. Default: results are sorted by best match.</td>
</tr>
<tr>
<td><code>order</code></td>
<td><code>string</code></td>
<td>The sort order if <code>sort</code> parameter is provided. One of <code>asc</code> or <code>desc</code>. Default: <code>desc</code>
</td>
</tr>
</tbody>
</table>
<p>The <code>q</code> search term can also contain any combination of the supported code search qualifiers:</p>
<ul>
<li>
<a href="https://help.github.com/articles/searching-code#search-in"><code>in</code></a>
Qualifies which fields are searched. With this qualifier you can restrict the
search to just the file contents, the file path, or both.</li>
<li>
<a href="https://help.github.com/articles/searching-code#language"><code>language</code></a>
Searches code based on the language it’s written in.</li>
<li>
<a href="https://help.github.com/articles/searching-code#forks"><code>fork</code></a>
Specifies that code from forked repositories should be searched. Repository
forks will not be searchable unless the fork has more stars than the parent
repository.</li>
<li>
<a href="https://help.github.com/articles/searching-code#size"><code>size</code></a>
Finds files that match a certain size (in bytes).</li>
<li>
<a href="https://help.github.com/articles/searching-code#path"><code>path</code></a>
Specifies the path that the resulting file must be at.</li>
<li>
<a href="https://help.github.com/articles/searching-code#extension"><code>extension</code></a>
Matches files with a certain extension.</li>
<li>
<a href="https://help.github.com/articles/searching-code#users-organizations-and-repositories"><code>user</code> or <code>repo</code></a>
Limits searches to a specific user or repository.</li>
</ul>
<h4 id="code-search-example">Example</h4>
<p>Suppose you want to find the definition of the <code>addClass</code> function inside
<a href="https://github.com/jquery/jquery">jQuery</a>. Your query would look something like
this:</p>
<pre><code>https://api.github.com/search/code?q=addClass+in:file+language:js+repo:jquery/jquery
</code></pre>
<p>Here, we’re searching for the keyword <code>addClass</code> within a file’s contents. We’re
making sure that we’re only looking in files where the language is JavaScript.
And we’re scoping the search to the <code>repo:jquery/jquery</code> repository.</p>
<pre class="headers"><code>Status: 200 OK
X-RateLimit-Limit: 20
X-RateLimit-Remaining: 19</code></pre>
<pre><code class="language-javascript"><span class="p">{</span>
<span class="s2">"total_count"</span><span class="o">:</span> <span class="mi">7</span><span class="p">,</span>
<span class="s2">"items"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"name"</span><span class="o">:</span> <span class="s2">"classes.js"</span><span class="p">,</span>
<span class="s2">"path"</span><span class="o">:</span> <span class="s2">"src/attributes/classes.js"</span><span class="p">,</span>
<span class="s2">"sha"</span><span class="o">:</span> <span class="s2">"d7212f9dee2dcc18f084d7df8f417b80846ded5a"</span><span class="p">,</span>
<span class="s2">"url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repositories/167174/contents/src/attributes/classes.js?ref=825ac3773694e0cd23ee74895fd5aeb535b27da4"</span><span class="p">,</span>
<span class="s2">"git_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repositories/167174/git/blobs/d7212f9dee2dcc18f084d7df8f417b80846ded5a"</span><span class="p">,</span>
<span class="s2">"html_url"</span><span class="o">:</span> <span class="s2">"https://github.com/jquery/jquery/blob/825ac3773694e0cd23ee74895fd5aeb535b27da4/src/attributes/classes.js"</span><span class="p">,</span>
<span class="s2">"repository"</span><span class="o">:</span> <span class="p">{</span>
<span class="s2">"id"</span><span class="o">:</span> <span class="mi">167174</span><span class="p">,</span>
<span class="s2">"name"</span><span class="o">:</span> <span class="s2">"jquery"</span><span class="p">,</span>
<span class="s2">"full_name"</span><span class="o">:</span> <span class="s2">"jquery/jquery"</span><span class="p">,</span>
<span class="s2">"owner"</span><span class="o">:</span> <span class="p">{</span>
<span class="s2">"login"</span><span class="o">:</span> <span class="s2">"jquery"</span><span class="p">,</span>
<span class="s2">"id"</span><span class="o">:</span> <span class="mi">70142</span><span class="p">,</span>
<span class="s2">"avatar_url"</span><span class="o">:</span> <span class="s2">"https://0.gravatar.com/avatar/6906f317a4733f4379b06c32229ef02f?d=https%3A%2F%2Fidenticons.github.com%2Ff426f04f2f9813718fb806b30e0093de.png"</span><span class="p">,</span>
<span class="s2">"gravatar_id"</span><span class="o">:</span> <span class="s2">"6906f317a4733f4379b06c32229ef02f"</span><span class="p">,</span>
<span class="s2">"url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/jquery"</span><span class="p">,</span>
<span class="s2">"html_url"</span><span class="o">:</span> <span class="s2">"https://github.com/jquery"</span><span class="p">,</span>
<span class="s2">"followers_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/jquery/followers"</span><span class="p">,</span>
<span class="s2">"following_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/jquery/following{/other_user}"</span><span class="p">,</span>
<span class="s2">"gists_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/jquery/gists{/gist_id}"</span><span class="p">,</span>
<span class="s2">"starred_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/jquery/starred{/owner}{/repo}"</span><span class="p">,</span>
<span class="s2">"subscriptions_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/jquery/subscriptions"</span><span class="p">,</span>
<span class="s2">"organizations_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/jquery/orgs"</span><span class="p">,</span>
<span class="s2">"repos_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/jquery/repos"</span><span class="p">,</span>
<span class="s2">"events_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/jquery/events{/privacy}"</span><span class="p">,</span>
<span class="s2">"received_events_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/jquery/received_events"</span><span class="p">,</span>
<span class="s2">"type"</span><span class="o">:</span> <span class="s2">"Organization"</span><span class="p">,</span>
<span class="s2">"site_admin"</span><span class="o">:</span> <span class="kc">false</span>
<span class="p">},</span>
<span class="s2">"private"</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span>
<span class="s2">"html_url"</span><span class="o">:</span> <span class="s2">"https://github.com/jquery/jquery"</span><span class="p">,</span>
<span class="s2">"description"</span><span class="o">:</span> <span class="s2">"jQuery JavaScript Library"</span><span class="p">,</span>
<span class="s2">"fork"</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span>
<span class="s2">"url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery"</span><span class="p">,</span>
<span class="s2">"forks_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/forks"</span><span class="p">,</span>
<span class="s2">"keys_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/keys{/key_id}"</span><span class="p">,</span>
<span class="s2">"collaborators_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/collaborators{/collaborator}"</span><span class="p">,</span>
<span class="s2">"teams_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/teams"</span><span class="p">,</span>
<span class="s2">"hooks_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/hooks"</span><span class="p">,</span>
<span class="s2">"issue_events_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/issues/events{/number}"</span><span class="p">,</span>
<span class="s2">"events_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/events"</span><span class="p">,</span>
<span class="s2">"assignees_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/assignees{/user}"</span><span class="p">,</span>
<span class="s2">"branches_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/branches{/branch}"</span><span class="p">,</span>
<span class="s2">"tags_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/tags"</span><span class="p">,</span>
<span class="s2">"blobs_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/git/blobs{/sha}"</span><span class="p">,</span>
<span class="s2">"git_tags_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/git/tags{/sha}"</span><span class="p">,</span>
<span class="s2">"git_refs_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/git/refs{/sha}"</span><span class="p">,</span>
<span class="s2">"trees_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/git/trees{/sha}"</span><span class="p">,</span>
<span class="s2">"statuses_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/statuses/{sha}"</span><span class="p">,</span>
<span class="s2">"languages_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/languages"</span><span class="p">,</span>
<span class="s2">"stargazers_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/stargazers"</span><span class="p">,</span>
<span class="s2">"contributors_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/contributors"</span><span class="p">,</span>
<span class="s2">"subscribers_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/subscribers"</span><span class="p">,</span>
<span class="s2">"subscription_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/subscription"</span><span class="p">,</span>
<span class="s2">"commits_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/commits{/sha}"</span><span class="p">,</span>
<span class="s2">"git_commits_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/git/commits{/sha}"</span><span class="p">,</span>
<span class="s2">"comments_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/comments{/number}"</span><span class="p">,</span>
<span class="s2">"issue_comment_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/issues/comments/{number}"</span><span class="p">,</span>
<span class="s2">"contents_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/contents/{+path}"</span><span class="p">,</span>
<span class="s2">"compare_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/compare/{base}...{head}"</span><span class="p">,</span>
<span class="s2">"merges_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/merges"</span><span class="p">,</span>
<span class="s2">"archive_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/{archive_format}{/ref}"</span><span class="p">,</span>
<span class="s2">"downloads_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/downloads"</span><span class="p">,</span>
<span class="s2">"issues_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/issues{/number}"</span><span class="p">,</span>
<span class="s2">"pulls_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/pulls{/number}"</span><span class="p">,</span>
<span class="s2">"milestones_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/milestones{/number}"</span><span class="p">,</span>
<span class="s2">"notifications_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/notifications{?since,all,participating}"</span><span class="p">,</span>
<span class="s2">"labels_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/jquery/jquery/labels{/name}"</span>
<span class="p">},</span>
<span class="s2">"score"</span><span class="o">:</span> <span class="mf">0.5269679</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span></code></pre>
<h3 id="highlighting-code-search-results">Highlighting Code Search Results</h3>
<p>Some API consumers will want to highlight the matching search terms when
displaying search results. The API offers additional metadata to support this
use case. To get this metadata in your search results, specify the <code>text-match</code>
media type in your Accept header. For example, via curl, the above query would
look like this:</p>
<pre><code>curl -H 'Accept: application/vnd.github.v3.text-match+json' \
https://api.github.com/search/code?q=addClass+in:file+language:js+repo:jquery/jquery
</code></pre>
<p>This produces the same JSON payload as above, with an extra key called
<code>text_matches</code>, an array of objects. These objects provide information such as
the position of your search terms within the text, as well as the property that
included the search term.</p>
<p>When searching for code, you can get text match metadata for the file
<strong>content</strong> and file <strong>path</strong> fields. (See the section on
<a href="#text-match-metadata">text match metadata</a> for full details.)</p>
<p>Here’s an example response:</p>
<pre><code class="language-javascript"><span class="p">{</span>
<span class="s2">"text_matches"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"object_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repositories/167174/contents/src/attributes/classes.js?ref=825ac3773694e0cd23ee74895fd5aeb535b27da4"</span><span class="p">,</span>
<span class="s2">"object_type"</span><span class="o">:</span> <span class="s2">"FileContent"</span><span class="p">,</span>
<span class="s2">"property"</span><span class="o">:</span> <span class="s2">"content"</span><span class="p">,</span>
<span class="s2">"fragment"</span><span class="o">:</span> <span class="s2">";\n\njQuery.fn.extend({\n\taddClass: function( value ) {\n\t\tvar classes, elem, cur, clazz, j, finalValue"</span><span class="p">,</span>
<span class="s2">"matches"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"text"</span><span class="o">:</span> <span class="s2">"addClass"</span><span class="p">,</span>
<span class="s2">"indices"</span><span class="o">:</span> <span class="p">[</span>
<span class="mi">23</span><span class="p">,</span>
<span class="mi">31</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="s2">"object_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repositories/167174/contents/src/attributes/classes.js?ref=825ac3773694e0cd23ee74895fd5aeb535b27da4"</span><span class="p">,</span>
<span class="s2">"object_type"</span><span class="o">:</span> <span class="s2">"FileContent"</span><span class="p">,</span>
<span class="s2">"property"</span><span class="o">:</span> <span class="s2">"content"</span><span class="p">,</span>
<span class="s2">"fragment"</span><span class="o">:</span> <span class="s2">".isFunction( value ) ) {\n\t\t\treturn this.each(function( j ) {\n\t\t\t\tjQuery( this ).addClass( value.call( this"</span><span class="p">,</span>
<span class="s2">"matches"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"text"</span><span class="o">:</span> <span class="s2">"addClass"</span><span class="p">,</span>
<span class="s2">"indices"</span><span class="o">:</span> <span class="p">[</span>
<span class="mi">80</span><span class="p">,</span>
<span class="mi">88</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span></code></pre>
<h2 id="search-issues">Search issues</h2>
<p>Find issues by state and keyword. (This method returns up to 100 results <a href="/v3/#pagination">per page</a>.)</p>
<pre><code>GET /search/issues
</code></pre>
<h3 id="parameters-2">Parameters</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>q</code></td>
<td><code>string</code></td>
<td>The search terms.</td>
</tr>
<tr>
<td><code>sort</code></td>
<td><code>string</code></td>
<td>The sort field. Can be <code>comments</code>, <code>created</code>, or <code>updated</code>. Default: results are sorted by best match.</td>
</tr>
<tr>
<td><code>order</code></td>
<td><code>string</code></td>
<td>The sort order if <code>sort</code> parameter is provided. One of <code>asc</code> or <code>desc</code>. Default: <code>desc</code>
</td>
</tr>
</tbody>
</table>
<p>The <code>q</code> search term can also contain any combination of the supported issue search qualifiers:</p>
<ul>
<li>
<a href="https://help.github.com/articles/searching-issues#type"><code>type</code></a>
With this qualifier you can restrict the search to issues or pull request only.</li>
<li>
<a href="https://help.github.com/articles/searching-issues#search-in"><code>in</code></a>
Qualifies which fields are searched. With this qualifier you can restrict the
search to just the title, body, comments, or any combination of these.</li>
<li>
<a href="https://help.github.com/articles/searching-issues#author"><code>author</code></a>
Finds issues created by a certain user.</li>
<li>
<a href="https://help.github.com/articles/searching-issues#assignee"><code>assignee</code></a>
Finds issues that are assigned to a certain user.</li>
<li>
<a href="https://help.github.com/articles/searching-issues#mentions"><code>mentions</code></a>
Finds issues that mention a certain user.</li>
<li>
<a href="https://help.github.com/articles/searching-issues#commenter"><code>commenter</code></a>
Finds issues that a certain user commented on.</li>
<li>
<a href="https://help.github.com/articles/searching-issues#involves"><code>involves</code></a>
Finds issues that were either created by a certain user, assigned to that
user, mention that user, or were commented on by that user.</li>
<li>
<a href="https://help.github.com/articles/searching-issues#state"><code>state</code></a>
Filter issues based on whether they’re open or closed.</li>
<li>
<a href="https://help.github.com/articles/searching-issues#labels"><code>labels</code></a>
Filters issues based on their labels.</li>
<li>
<a href="https://help.github.com/articles/searching-issues#language"><code>language</code></a>
Searches for issues within repositories that match a certain language.</li>
<li>
<a href="https://help.github.com/articles/searching-issues#created-and-last-updated"><code>created</code> or <code>updated</code></a>
Filters issues based on times of creation, or when they were last updated.</li>
<li>
<a href="https://help.github.com/articles/searching-issues#comments"><code>comments</code></a>
Filters issues based on the quantity of comments.</li>
<li>
<a href="https://help.github.com/articles/searching-issues#users-organizations-and-repositories"><code>user</code> or <code>repo</code></a>
Limits searches to a specific user or repository.</li>
</ul>
<h4 id="issue-search-example">Example</h4>
<p>Let’s say you want to find the oldest unresolved Python bugs on Windows. Your
query might look something like this.</p>
<pre><code>https://api.github.com/search/issues?q=windows+label:bug+language:python+state:open&sort=created&order=asc
</code></pre>
<p>In this query, we’re searching for the keyword <code>windows</code>, within any open issue
that’s labeled as <code>bug</code>. The search runs across repositories whose primary
language is Python. We’re sorting by creation date in ascending order, so that
the oldest issues appear first in the search results.</p>
<pre class="headers"><code>Status: 200 OK
X-RateLimit-Limit: 20
X-RateLimit-Remaining: 19</code></pre>
<pre><code class="language-javascript"><span class="p">{</span>
<span class="s2">"total_count"</span><span class="o">:</span> <span class="mi">280</span><span class="p">,</span>
<span class="s2">"items"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132"</span><span class="p">,</span>
<span class="s2">"labels_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132/labels{/name}"</span><span class="p">,</span>
<span class="s2">"comments_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132/comments"</span><span class="p">,</span>
<span class="s2">"events_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132/events"</span><span class="p">,</span>
<span class="s2">"html_url"</span><span class="o">:</span> <span class="s2">"https://github.com/batterseapower/pinyin-toolkit/issues/132"</span><span class="p">,</span>
<span class="s2">"id"</span><span class="o">:</span> <span class="mi">35802</span><span class="p">,</span>
<span class="s2">"number"</span><span class="o">:</span> <span class="mi">132</span><span class="p">,</span>
<span class="s2">"title"</span><span class="o">:</span> <span class="s2">"Line Number Indexes Beyond 20 Not Displayed"</span><span class="p">,</span>
<span class="s2">"user"</span><span class="o">:</span> <span class="p">{</span>
<span class="s2">"login"</span><span class="o">:</span> <span class="s2">"Nick3C"</span><span class="p">,</span>
<span class="s2">"id"</span><span class="o">:</span> <span class="mi">90254</span><span class="p">,</span>
<span class="s2">"avatar_url"</span><span class="o">:</span> <span class="s2">"https://secure.gravatar.com/avatar/934442aadfe3b2f4630510de416c5718?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"</span><span class="p">,</span>
<span class="s2">"gravatar_id"</span><span class="o">:</span> <span class="s2">"934442aadfe3b2f4630510de416c5718"</span><span class="p">,</span>
<span class="s2">"url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/Nick3C"</span><span class="p">,</span>
<span class="s2">"html_url"</span><span class="o">:</span> <span class="s2">"https://github.com/Nick3C"</span><span class="p">,</span>
<span class="s2">"followers_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/Nick3C/followers"</span><span class="p">,</span>
<span class="s2">"following_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/Nick3C/following{/other_user}"</span><span class="p">,</span>
<span class="s2">"gists_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/Nick3C/gists{/gist_id}"</span><span class="p">,</span>
<span class="s2">"starred_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/Nick3C/starred{/owner}{/repo}"</span><span class="p">,</span>
<span class="s2">"subscriptions_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/Nick3C/subscriptions"</span><span class="p">,</span>
<span class="s2">"organizations_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/Nick3C/orgs"</span><span class="p">,</span>
<span class="s2">"repos_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/Nick3C/repos"</span><span class="p">,</span>
<span class="s2">"events_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/Nick3C/events{/privacy}"</span><span class="p">,</span>
<span class="s2">"received_events_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/Nick3C/received_events"</span><span class="p">,</span>
<span class="s2">"type"</span><span class="o">:</span> <span class="s2">"User"</span>
<span class="p">},</span>
<span class="s2">"labels"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repos/batterseapower/pinyin-toolkit/labels/bug"</span><span class="p">,</span>
<span class="s2">"name"</span><span class="o">:</span> <span class="s2">"bug"</span><span class="p">,</span>
<span class="s2">"color"</span><span class="o">:</span> <span class="s2">"ff0000"</span>
<span class="p">}</span>
<span class="p">],</span>
<span class="s2">"state"</span><span class="o">:</span> <span class="s2">"open"</span><span class="p">,</span>
<span class="s2">"assignee"</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
<span class="s2">"milestone"</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
<span class="s2">"comments"</span><span class="o">:</span> <span class="mi">15</span><span class="p">,</span>
<span class="s2">"created_at"</span><span class="o">:</span> <span class="s2">"2009-07-12T20:10:41Z"</span><span class="p">,</span>
<span class="s2">"updated_at"</span><span class="o">:</span> <span class="s2">"2009-07-19T09:23:43Z"</span><span class="p">,</span>
<span class="s2">"closed_at"</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
<span class="s2">"pull_request"</span><span class="o">:</span> <span class="p">{</span>
<span class="s2">"html_url"</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
<span class="s2">"diff_url"</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
<span class="s2">"patch_url"</span><span class="o">:</span> <span class="kc">null</span>
<span class="p">},</span>
<span class="s2">"body"</span><span class="o">:</span> <span class="s2">"..."</span><span class="p">,</span>
<span class="s2">"score"</span><span class="o">:</span> <span class="mf">1.3859273</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span></code></pre>
<h3 id="highlighting-issue-search-results">Highlighting Issue Search Results</h3>
<p>Some API consumers will want to highlight the matching search terms when
displaying search results. The API offers additional metadata to support this
use case. To get this metadata in your search results, specify the <code>text-match</code>
media type in your Accept header. For example, via curl, the above query would
look like this:</p>
<pre><code>curl -H 'Accept: application/vnd.github.v3.text-match+json' \
https://api.github.com/search/issues?q=windows+label:bug+language:python+state:open&sort=created&order=asc
</code></pre>
<p>This produces the same JSON payload as above, with an extra key called
<code>text_matches</code>, an array of objects. These objects provide information such as
the position of your search terms within the text, as well as the property that
included the search term.</p>
<p>When searching for issues, you can get text match metadata for the issue
<strong>title</strong>, issue <strong>body</strong>, and issue <strong>comment body</strong> fields. (See the section
on <a href="#text-match-metadata">text match metadata </a> for full details.)</p>
<p>Here’s an example response:</p>
<pre><code class="language-javascript"><span class="p">{</span>
<span class="s2">"text_matches"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"object_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repositories/215335/issues/132"</span><span class="p">,</span>
<span class="s2">"object_type"</span><span class="o">:</span> <span class="s2">"Issue"</span><span class="p">,</span>
<span class="s2">"property"</span><span class="o">:</span> <span class="s2">"body"</span><span class="p">,</span>
<span class="s2">"fragment"</span><span class="o">:</span> <span class="s2">"comprehensive windows font I know of).\n\nIf we can find a commonly distributed windows font that supports them then no problem (we can use html font tags) but otherwise the '(21)' style is probably better.\n"</span><span class="p">,</span>
<span class="s2">"matches"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"text"</span><span class="o">:</span> <span class="s2">"windows"</span><span class="p">,</span>
<span class="s2">"indices"</span><span class="o">:</span> <span class="p">[</span>
<span class="mi">14</span><span class="p">,</span>
<span class="mi">21</span>
<span class="p">]</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="s2">"text"</span><span class="o">:</span> <span class="s2">"windows"</span><span class="p">,</span>
<span class="s2">"indices"</span><span class="o">:</span> <span class="p">[</span>
<span class="mi">78</span><span class="p">,</span>
<span class="mi">85</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="s2">"object_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repositories/215335/issues/comments/25688"</span><span class="p">,</span>
<span class="s2">"object_type"</span><span class="o">:</span> <span class="s2">"IssueComment"</span><span class="p">,</span>
<span class="s2">"property"</span><span class="o">:</span> <span class="s2">"body"</span><span class="p">,</span>
<span class="s2">"fragment"</span><span class="o">:</span> <span class="s2">" right after that are a bit broken IMHO :). I suppose we could have some hack that maxes out at whatever the font does...\n\nI'll check what the state of play is on Windows.\n"</span><span class="p">,</span>
<span class="s2">"matches"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"text"</span><span class="o">:</span> <span class="s2">"Windows"</span><span class="p">,</span>
<span class="s2">"indices"</span><span class="o">:</span> <span class="p">[</span>
<span class="mi">163</span><span class="p">,</span>
<span class="mi">170</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span></code></pre>
<h2 id="search-users">Search users</h2>
<p>Find users via various criteria. (This method returns up to 100 results <a href="/v3/#pagination">per page</a>.)</p>
<pre><code>GET /search/users
</code></pre>
<h3 id="parameters-3">Parameters</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>q</code></td>
<td><code>string</code></td>
<td>The search terms.</td>
</tr>
<tr>
<td><code>sort</code></td>
<td><code>string</code></td>
<td>The sort field. Can be <code>followers</code>, <code>repositories</code>, or <code>joined</code>. Default: results are sorted by best match.</td>
</tr>
<tr>
<td><code>order</code></td>
<td><code>string</code></td>
<td>The sort order if <code>sort</code> parameter is provided. One of <code>asc</code> or <code>desc</code>. Default: <code>desc</code>
</td>
</tr>
</tbody>
</table>
<p>The <code>q</code> search term can also contain any combination of the supported user search qualifiers:</p>
<ul>
<li>
<a href="https://help.github.com/articles/searching-users#type"><code>type</code></a>
With this qualifier you can restrict the search to just personal accounts or
just organization accounts.</li>
<li>
<a href="https://help.github.com/articles/searching-users#search-in"><code>in</code></a>
Qualifies which fields are searched. With this qualifier you can restrict
the search to just the username, public email, full name, or any
combination of these.</li>
<li>
<a href="https://help.github.com/articles/searching-users#repository-count"><code>repos</code></a>
Filters users based on the number of repositories they have.</li>
<li>
<a href="https://help.github.com/articles/searching-users#location"><code>location</code></a>
Filter users by the location indicated in their profile.</li>
<li>
<a href="https://help.github.com/articles/searching-users#language"><code>language</code></a>
Search for users that have repositories that match a certain language.</li>
<li>
<a href="https://help.github.com/articles/searching-users#created"><code>created</code></a>
Filter users based on when they joined.</li>
<li>
<a href="https://help.github.com/articles/searching-users#followers"><code>followers</code></a>
Filter users based on the number of followers they have.</li>
</ul>
<h4 id="user-search-example">Example</h4>
<p>Imagine you’re looking for a list of popular users. You might try out this query:</p>
<pre><code>https://api.github.com/search/users?q=tom+repos:%3E42+followers:%3E1000
</code></pre>
<p>Here, we’re looking at users with the name Tom. We’re only interested in those
with more than 42 repositories, and only if they have over 1,000 followers.</p>
<pre class="headers"><code>Status: 200 OK
X-RateLimit-Limit: 20
X-RateLimit-Remaining: 19</code></pre>
<pre><code class="language-javascript"><span class="p">{</span>
<span class="s2">"total_count"</span><span class="o">:</span> <span class="mi">12</span><span class="p">,</span>
<span class="s2">"items"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"login"</span><span class="o">:</span> <span class="s2">"mojombo"</span><span class="p">,</span>
<span class="s2">"id"</span><span class="o">:</span> <span class="mi">1</span><span class="p">,</span>
<span class="s2">"avatar_url"</span><span class="o">:</span> <span class="s2">"https://secure.gravatar.com/avatar/25c7c18223fb42a4c6ae1c8db6f50f9b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"</span><span class="p">,</span>
<span class="s2">"gravatar_id"</span><span class="o">:</span> <span class="s2">"25c7c18223fb42a4c6ae1c8db6f50f9b"</span><span class="p">,</span>
<span class="s2">"url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/mojombo"</span><span class="p">,</span>
<span class="s2">"html_url"</span><span class="o">:</span> <span class="s2">"https://github.com/mojombo"</span><span class="p">,</span>
<span class="s2">"followers_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/mojombo/followers"</span><span class="p">,</span>
<span class="s2">"subscriptions_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/mojombo/subscriptions"</span><span class="p">,</span>
<span class="s2">"organizations_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/mojombo/orgs"</span><span class="p">,</span>
<span class="s2">"repos_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/mojombo/repos"</span><span class="p">,</span>
<span class="s2">"received_events_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/mojombo/received_events"</span><span class="p">,</span>
<span class="s2">"type"</span><span class="o">:</span> <span class="s2">"User"</span><span class="p">,</span>
<span class="s2">"score"</span><span class="o">:</span> <span class="mf">105.47857</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span></code></pre>
<h3 id="highlighting-user-search-results">Highlighting User Search Results</h3>
<p>Some API consumers will want to highlight the matching search terms when
displaying search results. The API offers additional metadata to support this
use case. To get this metadata in your search results, specify the <code>text-match</code>
media type in your Accept header. For example, via curl, the above query would
look like this:</p>
<pre><code>curl -H 'Accept: application/vnd.github.v3.text-match+json' \
https://api.github.com/search/users?q=tom+repos:%3E42+followers:%3E1000
</code></pre>
<p>This produces the same JSON payload as above, with an extra key called
<code>text_matches</code>, an array of objects. These objects provide information such as
the position of your search terms within the text, as well as the property that
included the search term.</p>
<p>When searching for users, you can get text match metadata for the issue
<strong>login</strong>, <strong>email</strong>, and <strong>name</strong> fields. (See the section on <a href="#text-match-metadata">text match
metadata</a> for full details.)</p>
<pre><code class="language-javascript"><span class="p">{</span>
<span class="s2">"text_matches"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"object_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/mojombo"</span><span class="p">,</span>
<span class="s2">"object_type"</span><span class="o">:</span> <span class="s2">"User"</span><span class="p">,</span>
<span class="s2">"property"</span><span class="o">:</span> <span class="s2">"email"</span><span class="p">,</span>
<span class="s2">"fragment"</span><span class="o">:</span> <span class="s2">"tom@github.com"</span><span class="p">,</span>
<span class="s2">"matches"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"text"</span><span class="o">:</span> <span class="s2">"tom"</span><span class="p">,</span>
<span class="s2">"indices"</span><span class="o">:</span> <span class="p">[</span>
<span class="mi">0</span><span class="p">,</span>
<span class="mi">3</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="s2">"object_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/users/mojombo"</span><span class="p">,</span>
<span class="s2">"object_type"</span><span class="o">:</span> <span class="s2">"User"</span><span class="p">,</span>
<span class="s2">"property"</span><span class="o">:</span> <span class="s2">"name"</span><span class="p">,</span>
<span class="s2">"fragment"</span><span class="o">:</span> <span class="s2">"Tom Preston-Werner"</span><span class="p">,</span>
<span class="s2">"matches"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"text"</span><span class="o">:</span> <span class="s2">"Tom"</span><span class="p">,</span>
<span class="s2">"indices"</span><span class="o">:</span> <span class="p">[</span>
<span class="mi">0</span><span class="p">,</span>
<span class="mi">3</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span></code></pre>
<h2 id="text-match-metadata">Text match metadata</h2>
<p>On github.com, we enjoy the context provided by code snippets and highlights in
search results.</p>
<p><a href="https://f.cloud.github.com/assets/865/819651/959a4826-efb5-11e2-8af8-46c4a3857cdf.png"><img src="https://f.cloud.github.com/assets/865/819651/959a4826-efb5-11e2-8af8-46c4a3857cdf.png" alt="code-snippet-highlighting"></a></p>
<p>API consumers have access to that information as well. Requests can opt to
receive those text fragments in the response, and every fragment is accompanied
by numeric offsets identifying the exact location of each matching search term.</p>
<p>To get this metadata in your search results, specify the <code>text-match</code> media type
in your Accept header.</p>
<pre><code>application/vnd.github.v3.text-match+json
</code></pre>
<p>The results will provide the same JSON payloads as shown above, with an extra
key called <code>text_matches</code>. Inside the <code>text_matches</code> array, each hash includes
the following attributes:</p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>object_url</code></td>
<td>The URL for the resource that contains a string property matching one of the search terms.</td>
</tr>
<tr>
<td><code>object_type</code></td>
<td>The name for the type of resource that exists at the given <code>object_url</code>.</td>
</tr>
<tr>
<td><code>property</code></td>
<td>The name of a property of the resource that exists at <code>object_url</code>. That property is a string that matches one of the search terms. (In the JSON returned from <code>object_url</code>, the full content for the <code>fragment</code> will be found in the property with this name.)</td>
</tr>
<tr>
<td><code>fragment</code></td>
<td>A subset of the value of <code>property</code>. This is the text fragment that matches one or more of the search terms.</td>
</tr>
<tr>
<td><code>matches</code></td>
<td>An array of one or more search terms that are present in <code>fragment</code>. The indices (i.e., “offsets”) are relative to the fragment. (They are not relative to the <em>full</em> content of <code>property</code>.)</td>
</tr>
</tbody>
</table>
<h3 id="example">Example</h3>
<p>Using curl, and the <a href="#issue-search-example">example issue search</a> above, our API
request would look like this:</p>
<pre><code>curl -H 'Accept: application/vnd.github.v3.text-match+json' \
https://api.github.com/search/issues?q=windows+label:bug+language:python+state:open&sort=created&order=asc
</code></pre>
<p>The response will include a <code>text_matches</code> array for each search result. In the
JSON below, we have two objects in the <code>text_matches</code> array.</p>
<p>The first text match occurred in the <code>body</code> property of the issue. We see a
fragment of text from the issue body. The search term (<code>windows</code>) appears twice
within that fragment, and we have the indices for each occurrence.</p>
<p>The second text match occurred in the <code>body</code> property of one of the issue’s
comments. We have the URL for the issue comment. And of course, we see a
fragment of text from the comment body. The search term (<code>windows</code>) appears once
within that fragment.</p>
<pre><code class="language-javascript"><span class="p">{</span>
<span class="s2">"text_matches"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"object_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repositories/215335/issues/132"</span><span class="p">,</span>
<span class="s2">"object_type"</span><span class="o">:</span> <span class="s2">"Issue"</span><span class="p">,</span>
<span class="s2">"property"</span><span class="o">:</span> <span class="s2">"body"</span><span class="p">,</span>
<span class="s2">"fragment"</span><span class="o">:</span> <span class="s2">"comprehensive windows font I know of).\n\nIf we can find a commonly distributed windows font that supports them then no problem (we can use html font tags) but otherwise the '(21)' style is probably better.\n"</span><span class="p">,</span>
<span class="s2">"matches"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"text"</span><span class="o">:</span> <span class="s2">"windows"</span><span class="p">,</span>
<span class="s2">"indices"</span><span class="o">:</span> <span class="p">[</span>
<span class="mi">14</span><span class="p">,</span>
<span class="mi">21</span>
<span class="p">]</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="s2">"text"</span><span class="o">:</span> <span class="s2">"windows"</span><span class="p">,</span>
<span class="s2">"indices"</span><span class="o">:</span> <span class="p">[</span>
<span class="mi">78</span><span class="p">,</span>
<span class="mi">85</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="s2">"object_url"</span><span class="o">:</span> <span class="s2">"https://api.github.com/repositories/215335/issues/comments/25688"</span><span class="p">,</span>
<span class="s2">"object_type"</span><span class="o">:</span> <span class="s2">"IssueComment"</span><span class="p">,</span>
<span class="s2">"property"</span><span class="o">:</span> <span class="s2">"body"</span><span class="p">,</span>
<span class="s2">"fragment"</span><span class="o">:</span> <span class="s2">" right after that are a bit broken IMHO :). I suppose we could have some hack that maxes out at whatever the font does...\n\nI'll check what the state of play is on Windows.\n"</span><span class="p">,</span>
<span class="s2">"matches"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"text"</span><span class="o">:</span> <span class="s2">"Windows"</span><span class="p">,</span>
<span class="s2">"indices"</span><span class="o">:</span> <span class="p">[</span>
<span class="mi">163</span><span class="p">,</span>
<span class="mi">170</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span></code></pre>
</div>
<div id="js-sidebar" class="sidebar-shell">
<div class="js-toggle-list sidebar-module expandable">
<ul>
<li class="js-topic">
<h3><a href="#" class="js-expand-btn collapsed arrow-btn"></a><a href="/v3/">Overview</a></h3>
<ul class="js-guides">
<li><a href="/v3/media/">Media Types</a></li>
<li><a href="/v3/oauth/">OAuth</a></li>
<li><a href="/v3/auth/">Other Authentication Methods</a></li>
<li><a href="/v3/troubleshooting/">Troubleshooting</a></li>
<li><a href="/v3/versions/">Versions</a></li>
</ul>
</li>
<li class="js-topic">
<h3><a href="#" class="js-expand-btn collapsed arrow-btn"></a><a href="/v3/activity/">Activity</a></h3>
<ul class="js-guides">
<li><a href="/v3/activity/events/">Events</a></li>
<li><a href="/v3/activity/events/types/">Event Types</a></li>
<li><a href="/v3/activity/feeds/">Feeds</a></li>
<li><a href="/v3/activity/notifications/">Notifications</a></li>
<li><a href="/v3/activity/starring/">Starring</a></li>
<li><a href="/v3/activity/watching/">Watching</a></li>
</ul>
</li>