Skip to content

Bookmark

Csaba Okrona edited this page Oct 5, 2020 · 13 revisions

Instapaper's bookmark API

Read more at the official Instapaper API docs page

Operations

List

svc := instapaper.BookmarkServiceOp{
			Client: apiClient,
		}
		bookmarkList, err := svc.List(instapaper.BookmarkListRequestParams{
			Limit: 5,
		})

This returns a BookmarkListResponse instance:

type BookmarkListResponse struct {
	Bookmarks   []Bookmark
	Highlights  []Highlight
	RawResponse string
}

The RawResponse field contanins the unmodified response from Instapaper in case you want to decode it yourself or debug what's happening. You can use a BookmarkListRequestParams instance to define what you want returned:

type BookmarkListRequestParams struct {
	Limit           int
	Skip            []Bookmark
	CustomHaveParam string
	Folder          string
}

Limit is the maximum number of bookmarks the API should return - the maximum is 500.

You can optionally pass a slice of bookmarks for Skip so the response won't contain them. Instapaper has a more intricate way of filtering out bookmarks, so you can pass your custom filtering string with CustomHaveParam - if this field is not empty, Skip will not be passed in the API call. The weird name is related to how it's called in the API itself. Read more at the official Instapaper API docs page

Finally, you can get bookmarks from a specific folder by filling out the Folder parameter.

There's also a default set of parameters defined: DefaultBookmarkListRequestParams - this does no filtering and maxes out the number of returned items to 500.

GetText

Returns the specified bookmark's processed text-view HTML, which is always text/html encoded as UTF-8.

txt, err := svc.GetText(bookmarkList.Bookmarks[0].ID)