🏛️
CRLCA
  • Overview
  • Quick Start
  • Change Log
  • How-To Guides
    • Querying Multiple Fields
    • Translating a Search URL into an API Query
    • Converting JSON to CSV
    • Embedding PDF Documents
  • API Reference
    • Endpoints
      • Case ID
      • Case Ongoing
      • Case Type
      • Special Collection
      • Case State
      • Case Court
      • Case Status
      • Plaintiffs
        • Public Interest Lawyer
        • Filed Pro Se
        • Class Action Sought
        • Class Action Outcome
        • Attorney Organization
        • Plaintiff Type
      • Defendants
        • Defendant Type
        • Defendant Level
        • Facility type
      • Case Details
        • Cause of Action
        • Available Documents
        • Constitutional Clause
        • Special Case Type
      • Outcome
        • Case Settlement Status
        • Case Relief Source
        • Case Relief Nature
        • Case Content of Injunction
        • Case Prevailing Party
      • Document Details
        • Document Type
      • Issues
        • Case Issue
        • Case Custom Issue
    • Objects
      • Case
        • Case Details
        • Causes of Action
        • Outcome
        • Issues
        • Key Dates
        • Parties
        • Dockets and Case Numbers
        • Documents
        • Resources
        • Summaries
        • Case Status
      • Defendant
      • Docket
      • Docket Entry
      • Document
        • Document Details
        • Citations
      • Resource
        • Resource Details
        • Related Items
  • Need Help?
Powered by GitBook
On this page
  1. How-To Guides

Translating a Search URL into an API Query

PreviousQuerying Multiple FieldsNextConverting JSON to CSV

Last updated 2 years ago

If you have a search query on the Clearinghouse website that you'd like to translate into an equivalent API query, grab the url link from the search bar.

For example, if I did a search on 'Policing' case types and the 'Occupy' special collection, you would do the following on the website:

Take a look at the search bar and you will see the following url:

https://clearinghouse.net/search/case/?case_type=5039&special_collection=5658&ordering=-summary_approved_date
https://clearinghouse.net/api/v1/case?case_type=5039&special_collection=5658
import requests

url = "https://clearinghouse.net/api/v1/case?case_type=5039&special_collection=5658"
headers = { 'Authorization': 'Token XXXXXXXXXX',
'User-Agent': 'Chrome v22.2 Linux Ubuntu'
}
response = requests.request("GET", url, headers=headers, data={})

print(response.text)

The important thing to notice is case_type=5039 and special_collection=5658in the url. If you look up the and you will see 5039 correlates to Policing and 5658 correlates to Occupy. This can be translated into the following API query:

Case Type Endpoint
Special Collection Endpoint,