Skip to content

Instantly share code, notes, and snippets.

@kurtharriger
Last active December 31, 2022 16:34
Show Gist options
  • Save kurtharriger/4fa6da3a28419f76099920c1c38ce94f to your computer and use it in GitHub Desktop.
Save kurtharriger/4fa6da3a28419f76099920c1c38ce94f to your computer and use it in GitHub Desktop.
Inferred Workflowy API
type ProjectId = string; // eg: 2a13b3e1-7a74-3b2b-9758-1b398845a8e8
type UserId = number;
type ShareId = string;
type ClientId = string;
// login
// response sessionid returned in set-cookie
// curl -X POST https://workflowy.com/accounts/login/ -F 'username=<username>' -F'password=<password>' -H 'accept: application/json' -D -
export interface LoginFormData {
username: string;
password: string;
}
// curl 'https://workflowy.com/get_initialization_data?client_version=20' -H 'cookie: sessionid=<sessionid>;' -H 'accept: application/json' -D -
// curl 'https://workflowy.com/get_initialization_data?share_id=<share_id>&client_version=20' -H 'cookie: sessionid=<sessionid>;' -H 'accept: application/json' -D -
export interface InitializationQueryString {
share_id?: string;
client_version: 20;
}
export interface InitializationData {
projectTreeData: ProjectTreeData;
user: User;
globals?: [] | null;
settings: Settings;
features?: (FeaturesEntity)[] | null;
}
export interface ProjectTreeData {
clientId: ClientId;
mainProjectTreeInfo: ProjectTreeInfo;
auxiliaryProjectTreeInfos?: (ProjectTreeInfo)[] | null;
}
export interface ProjectTreeInfo {
rootProject?: RootProject | null; // root node when viewing shared project, otherwise null
rootProjectChildren?: (Project)[] | null;
initialMostRecentOperationTransactionId: string;
initialPollingIntervalInMs: number;
// first segment of ProjectId will appear here if node should be expanded
serverExpandedProjectsList?: (string)[] | null;
isReadOnly: boolean;
ownerId: UserId;
dateJoinedTimestampInSeconds: number;
itemsCreatedInCurrentMonth: number;
monthlyItemQuota: number;
overQuota?: boolean;
shareId?: string;
shareType?: string;
}
export interface RootProject {
id: ProjectId;
// name
nm: string;
// note
no?: string | null;
// last modified
lm?: number | null;
// completed
cp?: number | null;
}
export interface Project {
id: ProjectId;
// name
nm: string;
// note
no?: string | null;
// last modified
lm?: number | null;
// children
ch?: (Project)[] | null;
// completed
cp?: number | null;
shared?: Shared | null;
}
export interface Shared {
share_id: ShareId;
url_shared_info: UrlSharedInfo;
}
export interface UrlSharedInfo {
write_permission: boolean;
access_token: string;
}
export interface User {
id: UserId;
email: string;
firstName: string;
lastName: string;
emailVerified: boolean;
itemsCreated: number;
monthlyItemQuota: number;
referralLink: string;
referrerBonus: number;
refereeBonus: number;
isPro: boolean;
isCancelled: boolean;
hasActiveSubscription: boolean;
subscriptionEnd?: null;
isFreePro: boolean;
isDev: boolean;
}
export interface Settings {
theme: string;
font: string;
show_keyboard_shortcuts: boolean;
unsubscribe_from_summary_emails: boolean;
backup_to_dropbox: boolean;
email: string;
username: string;
last_seen_message_json_string: string;
saved_views_json: string;
features: Features;
}
export interface Features {
}
export interface FeaturesEntity {
codename: string;
name: string;
description: string;
}
// curl -X POST curl 'https://workflowy.com/push_and_poll' -H 'cookie: sessionid=<sessionid>;' -H 'accept: application/json' -F 'client_id=<client_id>' ... -D -
type PushAndPullId = string; // appears to be random 8 char string swci9hij
export interface PushAndPullFormData {
client_id: ClientId;
client_version: 20;
push_poll_id: PushAndPullId;
push_poll_data: PushAndPullData;
crosscheck_user_id: UserId;
}
export interface PushAndPullData {
most_recent_operation_transaction_id: string;
operations?: (OperationsEntity)[] | null;
}
export interface OperationsEntity {
type: string; // "create" | "edit" | "delete";
data: Data;
client_timestamp: number;
undo_data: UndoData;
}
export interface Data {
projectid: ProjectId;
parentid?: string | null;
priority?: number | null;
name?: string | null;
}
export interface UndoData {
previous_last_modified?: number | null;
previous_last_modified_by?: null;
previous_name?: string | null;
parentid?: string | null;
priority?: number | null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment