Skip to main content

Building Search Queries

To URL-encode your search queries, there are a lot of online websites that can help, such as this one.

Alternatively, most programming languages have some type of built-in support for URL-encoding as well.

Space

In search queries, a space should be used to denote words that should be grouped together by AND.

%20 and + are both used to denote spaces within URLs, with %20 tending to be used before query parameters and + tending to be used within query parameters. However, either works fine.

Meaning:

  • https://api.rsplit.io/v1/articles/search?apiKey=*&q=fractional%20shares
  • https://api.rsplit.io/v1/articles/search?apiKey=*&q=fractional+shares

are both equivalent.

Example Queries:

  • Find articles that mention rounding up any fractional shares that may result from a reverse stock split:

    • "rounding up"
    • fractional rounding
    • fractional "rounding up"
    • "fractional shares" "rounding up"
  • Find articles that do not mention companies giving cash-in-lieu of fractional shares:

    • -"cash-in-lieue"
  • Find articles mentioning companies having Computershare as their transfer agent and that are not rounding down fractional shares:

    • computershare -"rounding down"

URL-Encoding Support

As mentioned above, most programming languages offer built-in support for URL-encoding. Say we want to use the following query: fractional shares -"rounding"

main.go
package main

import (
"fmt"
"io"
"net/http"
"net/url"
)

func main() {
v := url.Values{}
v.Add("q", `fractional shares -"rounding"`)

apiUrl := fmt.Sprintf("https://api.rsplit.io/v1/articles/search?apiKey=YOUR_API_KEY&%s", v.Encode())

resp, err := http.Get(url)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()

body, err := io.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading body:", err)
return
}

fmt.Println(string(body))
}