Skip to content

Commit

Permalink
Merge branch 'main' into 4455-redis-memory-spike-from-task-throttling…
Browse files Browse the repository at this point in the history
…-and-queue-buildup
  • Loading branch information
albertisfu authored Sep 23, 2024
2 parents 6d6df0f + d7c6652 commit 246a134
Show file tree
Hide file tree
Showing 26 changed files with 1,642 additions and 363 deletions.
30 changes: 15 additions & 15 deletions cl/api/templates/alert-api-docs-vlatest.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<div class="col-xs-12 hidden-md hidden-lg">
<h4 class="v-offset-below-2">
<i class="fa fa-arrow-circle-o-left gray"></i>
<a href="{% url "rest_docs" version="v3" %}">Back to API Docs</a>
<a href="{% url "rest_docs" version=version %}">Back to API Docs</a>
</h4>
</div>

Expand All @@ -26,7 +26,7 @@ <h4 class="v-offset-below-2">
<div id="toc">
<h4 class="v-offset-below-3">
<i class="fa fa-arrow-circle-o-left gray"></i>
<a href="{% url "rest_docs" version="v3" %}">Back to API Docs</a>
<a href="{% url "rest_docs" version=version %}">Back to API Docs</a>
</h4>
<h3>Table of Contents</h3>
<ul>
Expand Down Expand Up @@ -56,7 +56,7 @@ <h1 id="about">Legal Alert&nbsp;APIs</h1>
<a href="{% url "alert_help" %}" class="btn btn-lg btn-primary">Learn About Alerts</a>
</p>

<h2 id="search">Search Alerts <small><nobr><code>{% url "alert-list" version="v3" %}</code></nobr></small></h2>
<h2 id="search">Search Alerts <small><nobr><code>{% url "alert-list" version=version %}</code></nobr></small></h2>
<p>Search Alerts update you when there is new information in our search engine.</p>
<p>This system scales to support thousands or even millions of alerts, allowing organizations to stay updated about numerous topics. This is a powerful system when used with <a href="{% url "webhooks_docs" %}">webhooks</a>.
</p>
Expand All @@ -77,7 +77,7 @@ <h2 id="search">Search Alerts <small>— <nobr><code>{% url "alert-list" version
<p>To learn more about this API, make an HTTP <code>OPTIONS</code> request:</p>
<pre class="pre-scrollable">curl -X OPTIONS \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "alert-list" version="v3" %}" </pre>
"{% get_full_host %}{% url "alert-list" version=version %}" </pre>

<h3 id="example">Example Usage</h3>
<p>Let's say we want to know about case law involving Apple Inc. On the front end, we search for "Apple Inc" (in quotes) and <a href="/?q=%22Apple%20Inc%22&type=o">get query parameters</a> like:
Expand All @@ -89,10 +89,10 @@ <h3 id="example">Example Usage</h3>
--data 'query=q=%22Apple%20Inc%22&type=o' \
--data 'rate=rt' \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "alert-list" version="v3" %}"</pre>
"{% get_full_host %}{% url "alert-list" version=version %}"</pre>
<p>The response:</p>
<pre class="pre-scrollable">{
"resource_uri": "https://www.courtlistener.com/api/rest/v3/alerts/4839/",
"resource_uri": "https://www.courtlistener.com/api/rest/{{ version }}/alerts/4839/",
"id": 4839,
"date_created": "2024-05-02T15:29:32.048912-07:00",
"date_modified": "2024-05-02T15:29:32.048929-07:00",
Expand All @@ -108,18 +108,18 @@ <h3 id="example">Example Usage</h3>
<pre class="pre-scrollable">curl -X PATCH \
--data 'rate=dly' \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "alert-detail" version="v3" pk="4839" %}"</pre>
"{% get_full_host %}{% url "alert-detail" version=version pk="4839" %}"</pre>
<p>Search Alerts can be deleted with HTTP <code>DELETE</code> requests:</p>
<pre class="pre-scrollable">curl -X DELETE \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "alert-detail" version="v3" pk="4839" %}"</pre>
"{% get_full_host %}{% url "alert-detail" version=version pk="4839" %}"</pre>
<p>To list your alerts, send an HTTP <code>GET</code> request with no filters:</p>
<pre class="pre-scrollable">curl -X GET \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "alert-list" version="v3" %}" </pre>
"{% get_full_host %}{% url "alert-list" version=version %}" </pre>


<h2 id="dockets">Docket Alerts <small><nobr><code>{% url "docket-alert-list" version="v3" %}</code></nobr></small></h2>
<h2 id="dockets">Docket Alerts <small><nobr><code>{% url "docket-alert-list" version=version %}</code></nobr></small></h2>
<p>Docket Alerts keep you updated about cases by sending notifications by email or webhook whenever there is new information in our system. Use this API to create, modify, list, and delete Docket Alerts.
</p>
<p>Docket Alerts are always sent as soon as an update is available. See <a href="{% url "alert_help" %}">the help page on Docket Alerts</a> to learn more about how we get updates.
Expand All @@ -138,7 +138,7 @@ <h2 id="dockets">Docket Alerts <small>— <nobr><code>{% url "docket-alert-list"
<p>To learn more about this API, make an HTTP <code>OPTIONS</code> request:</p>
<pre class="pre-scrollable">curl -X OPTIONS \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}'
"{% get_full_host %}{% url "docket-alert-list" version="v3" %}"</pre>
"{% get_full_host %}{% url "docket-alert-list" version=version %}"</pre>

<h3 id="docket-examples">Example Usage</h3>
<p>To create a Docket Alert, send a POST request with the <code>docket</code> ID you wish to subscribe to.
Expand All @@ -147,7 +147,7 @@ <h3 id="docket-examples">Example Usage</h3>
<pre class="pre-scrollable">curl -X POST \
--data 'docket=1' \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "docket-alert-list" version="v3" %}"</pre>
"{% get_full_host %}{% url "docket-alert-list" version=version %}"</pre>
<p>The response:</p>
<pre class="pre-scrollable">{
"id": 133013,
Expand All @@ -161,17 +161,17 @@ <h3 id="docket-examples">Example Usage</h3>
<p>To unsubscribe from a docket, you can either delete the alert with an HTTP <code>DELETE</code> request:</p>
<pre class="pre-scrollable">curl -X DELETE \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "docket-alert-detail" version="v3" pk="133013" %}"</pre>
"{% get_full_host %}{% url "docket-alert-detail" version=version pk="133013" %}"</pre>
<p>Or, if you are using @recap.email and have auto-subscribe enabled, you can send an HTTP <code>PATCH</code> request to change it from a subscription (<code>alert_type=1</code>) to an unsubscription (<code>alert_type=0</code>):
</p>
<pre class="pre-scrollable">curl -X PATCH \
--data 'alert_type=0' \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "docket-alert-detail" version="v3" pk="133013" %}"</pre>
"{% get_full_host %}{% url "docket-alert-detail" version=version pk="133013" %}"</pre>
<p>To list your Docket Alerts, send an HTTP <code>GET</code> request with no filters:</p>
<pre class="pre-scrollable">curl -X GET \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "docket-alert-list" version="v3" %}" </pre>
"{% get_full_host %}{% url "docket-alert-list" version=version %}" </pre>

<h2 id="coming-soon">Coming Soon</h2>
<p>We are currently developing a scalable alert system that will update you when keywords appear in PACER documents or cases. To join the beta test for this system, please <a href="{% url "contact" %}">get in touch</a>.
Expand Down
43 changes: 21 additions & 22 deletions cl/api/templates/case-law-api-docs-vlatest.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<div class="col-xs-12 hidden-md hidden-lg">
<h4 class="v-offset-below-2">
<i class="fa fa-arrow-circle-o-left gray"></i>
<a href="{% url "rest_docs" version="v3" %}">Back to API Docs</a>
<a href="{% url "rest_docs" version=version %}">Back to API Docs</a>
</h4>
</div>

Expand All @@ -27,7 +27,7 @@ <h4 class="v-offset-below-2">
<div id="toc">
<h4 class="v-offset-below-3">
<i class="fa fa-arrow-circle-o-left gray"></i>
<a href="{% url "rest_docs" version="v3" %}">Back to API Docs</a>
<a href="{% url "rest_docs" version=version %}">Back to API Docs</a>
</h4>
<h3>Table of Contents</h3>
<ul>
Expand Down Expand Up @@ -101,7 +101,7 @@ <h1 id="about">Case Law&nbsp;API</h1>


<h2 id="apis">The APIs</h2>
<h3 id="docket-endpoint">Dockets <small><code>{% url "docket-list" version="v3" %}</code></small></h3>
<h3 id="docket-endpoint">Dockets <small><code>{% url "docket-list" version=version %}</code></small></h3>
{% include "includes/docket-endpoint.html" %}
<p>The name of a docket can change in response to the outside world, but the names of clusters do not change. Therefore, we have <code>case_name</code> fields on both the docket and the cluster.
</p>
Expand All @@ -110,15 +110,15 @@ <h3 id="docket-endpoint">Dockets <small> — <code>{% url "docket-list" version=
<p>For more information on case names, see the <a href="{% url "field_api_help" %}#case-names">help article on this topic</a>.</p>


<h3 id="cluster-endpoint">Clusters <small><code>{% url "opinioncluster-list" version="v3" %}</code></small></h3>
<h3 id="cluster-endpoint">Clusters <small><code>{% url "opinioncluster-list" version=version %}</code></small></h3>
<p>This is a major API that provides the millions of <code>Opinion Clusters</code> that are available on CourtListener.
</p>
<p>As with all other APIs, you can look up the field descriptions, filtering, ordering, and rendering options by making an <code>OPTIONS</code> request:
</p>
<pre class="pre-scrollable">curl -v \
-X OPTIONS \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "opinioncluster-list" version="v3" %}"</pre>
"{% get_full_host %}{% url "opinioncluster-list" version=version %}"</pre>
<p>A few notes:</p>
<ul>
<li>
Expand All @@ -136,15 +136,15 @@ <h3 id="cluster-endpoint">Clusters <small> — <code>{% url "opinioncluster-list
</ul>


<h3 id="opinion-endpoint">Opinions <small><code>{% url "opinion-list" version="v3" %}</code></small></h3>
<h3 id="opinion-endpoint">Opinions <small><code>{% url "opinion-list" version=version %}</code></small></h3>
<p>This API contains the text and other metadata about specific decisions.
</p>
<p>As with all other APIs, you can look up the field descriptions, filtering, ordering, and rendering options by making an <code>OPTIONS</code> request:
</p>
<pre class="pre-scrollable">curl -v \
-X OPTIONS \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "opinion-list" version="v3" %}"</pre>
"{% get_full_host %}{% url "opinion-list" version=version %}"</pre>
<p>A few notes:</p>
<ul>
<li>
Expand Down Expand Up @@ -195,7 +195,7 @@ <h3 id="opinion-endpoint">Opinions <small> — <code>{% url "opinion-list" versi
</ul>


<h3 id="court-endpoint">Courts <small><code>{% url "court-list" version="v3" %}</code></small></h3>
<h3 id="court-endpoint">Courts <small><code>{% url "court-list" version=version %}</code></small></h3>
{% include "includes/court-endpoint.html" %}


Expand All @@ -205,15 +205,14 @@ <h3 id="filtering-court">Filtering to Opinions in a Court</h3>
</p>
<pre class="pre-scrollable">curl -v \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "opinion-list" version="v3" %}?cluster__docket__court=scotus"</pre>
"{% get_full_host %}{% url "opinion-list" version=version %}?cluster__docket__court=scotus"</pre>
<p>That returns:</p>
<pre class="pre-scrollable">{
"count": 521329,
"next": "https://www.courtlistener.com/api/rest/v3/opinions/?cluster__docket__court=scotus&page=2",
"next": "https://www.courtlistener.com/api/rest/{{ version }}/opinions/?cluster__docket__court=scotus&cursor=cD0xMDUxNjI5NA%3D%3D",
"previous": null,
"results": [
{
"resource_uri": "https://www.courtlistener.com/api/rest/v3/opinions/9973155/",
"resource_uri": "https://www.courtlistener.com/api/rest/{{ version }}/opinions/9973155/",
"id": 9973155,
...</pre>
<p>Such an approach is fine if all you want is the opinion object, but often you'll want the docket and the cluster too.
Expand All @@ -223,25 +222,25 @@ <h3 id="filtering-court">Filtering to Opinions in a Court</h3>
<p>For example, this gets the dockets from SCOTUS:</p>
<pre class="pre-scrollable">curl -v \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "docket-list" version="v3" %}?court=scotus"</pre>
"{% get_full_host %}{% url "docket-list" version=version %}?court=scotus"</pre>
<p>The first result contains a <code>clusters</code> key like:</p>
<pre class="pre-scrollable">"clusters": [
"{% get_full_host %}{% url "opinioncluster-detail" version="v3" pk="9502621" %}"
"{% get_full_host %}{% url "opinioncluster-detail" version=version pk="9502621" %}"
],</pre>
<p>So we can simply get that URL:</p>
<pre class="pre-scrollable">curl -v \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "opinioncluster-detail" version="v3" pk="9502621" %}"</pre>
"{% get_full_host %}{% url "opinioncluster-detail" version=version pk="9502621" %}"</pre>
<p>That returns a cluster, which has the following keys:</p>
<pre class="pre-scrollable">"docket": "{% get_full_host %}{% url "docket-detail" version="v3" pk="68533094" %}",
<pre class="pre-scrollable">"docket": "{% get_full_host %}{% url "docket-detail" version=version pk="68533094" %}",
"sub_opinions": [
"{% get_full_host %}{% url "opinion-detail" version="v3" pk="9969234" %}"
"{% get_full_host %}{% url "opinion-detail" version=version pk="9969234" %}"
],</pre>
<p>Finally, GET the links in the <code>sub_opinions</code> field to have the complete object:
</p>
<pre class="pre-scrollable">curl -v \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "opinion-detail" version="v3" pk="9969234" %}"</pre>
"{% get_full_host %}{% url "opinion-detail" version=version pk="9969234" %}"</pre>


<h3 id="filtering-dn">Filtering by Docket Number</h3>
Expand All @@ -250,15 +249,15 @@ <h3 id="filtering-dn">Filtering by Docket Number</h3>
<p>A docket by docket number:</p>
<pre class="pre-scrollable">curl -v \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "docket-list" version="v3" %}?docket_number=23A994"</pre>
"{% get_full_host %}{% url "docket-list" version=version %}?docket_number=23A994"</pre>
<p>A cluster by docket number:</p>
<pre class="pre-scrollable">curl -v \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "opinioncluster-list" version="v3" %}?docket__docket_number=23A994"</pre>
"{% get_full_host %}{% url "opinioncluster-list" version=version %}?docket__docket_number=23A994"</pre>
<p>An opinion by docket number:</p>
<pre class="pre-scrollable">curl -v \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "opinion-list" version="v3" %}?cluster__docket__docket_number=23A994"</pre>
"{% get_full_host %}{% url "opinion-list" version=version %}?cluster__docket__docket_number=23A994"</pre>
<p>Docket numbers are not unique, so you'll want to add a court filter too:
</p>
<ul>
Expand All @@ -281,7 +280,7 @@ <h3 id="by-url">Finding a Case by URL</h3>
<p>This case can be found in the cluster API using that same ID:</p>
<pre class="pre-scrollable">curl -v \
--header 'Authorization: Token {% if user.is_authenticated %}{{ user.auth_token }}{% else %}&lt;your-token-here&gt;{% endif %}' \
"{% get_full_host %}{% url "opinioncluster-detail" version="v3" pk="2812209" %}"</pre>
"{% get_full_host %}{% url "opinioncluster-detail" version=version pk="2812209" %}"</pre>
<p>Opinion IDs do not reliably match cluster IDs.</p>


Expand Down
Loading

0 comments on commit 246a134

Please sign in to comment.