API reference

Mirage Last.fm

Linking a Last.fm account, who sees your listening, and everyone's activity.
GET/v1/messaging/me/lastfm

Your linked Last.fm account (account: username, profile link, verified, when linked, visibility, showActivity, problem), or null, and which ways of linking work here (available.signIn, available.username).

Auth
A person's token or an API key, as Authorization: Bearer.
Get an API key

Errors

  • 403Only the person signed in can do this.
curl 'https://api.cactive.com.au/v1/messaging/me/lastfm' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
Send it from this page with your session or a key.

Response 200

{
  available: {
    signIn: boolean
    username: boolean
  }
  account: null | {
    username: string
    url: string
    verified: boolean
    linkedAt: number
    visibility: "everyone" | "me" | "friends"
    showActivity: boolean
    problem: null | "revoked" | "private" | "not_found"
  }
}
POST/v1/messaging/me/lastfm

Starts linking your Last.fm account: url is Last.fm's approval page, which sends you back to the Mirage app with a token (a one-time state, good for 10 minutes). app: the phone app's id, whose return page hands the token to the app.

Auth
A person's token or an API key, as Authorization: Bearer.
Get an API key

Errors

  • 403Only the person signed in can do this.
curl -X POST 'https://api.cactive.com.au/v1/messaging/me/lastfm' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
Send it from this page with your session or a key.

Response 200

{
  url: string
}
POST/v1/messaging/me/lastfm/callback

Finishes linking with what Last.fm sent back (state, token), for the person who started: the token becomes a session key (auth.getSession), kept sealed. A Last.fm account links to one person; this replaces anyone else's unverified link to it.

Auth
A person's token or an API key, as Authorization: Bearer.
Get an API key

Errors

  • 403Only the person signed in can do this.
curl -X POST 'https://api.cactive.com.au/v1/messaging/me/lastfm/callback' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
Send it from this page with your session or a key.

Response 200

{
  account: {
    username: string
    url: string
    verified: boolean
    linkedAt: number
    visibility: "everyone" | "me" | "friends"
    showActivity: boolean
    problem: null | "revoked" | "private" | "not_found"
  }
}
PUT/v1/messaging/me/lastfm/username

Links a Last.fm account by username alone (no sign-in): only public listening shows, and the link is unverified.

Auth
A person's token or an API key, as Authorization: Bearer.
Get an API key

Errors

  • 403Only the person signed in can do this.
curl -X PUT 'https://api.cactive.com.au/v1/messaging/me/lastfm/username' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
Send it from this page with your session or a key.

Response 200

{
  account: {
    username: string
    url: string
    verified: boolean
    linkedAt: number
    visibility: "everyone" | "me" | "friends"
    showActivity: boolean
    problem: null | "revoked" | "private" | "not_found"
  }
}
PATCH/v1/messaging/me/lastfm

Who sees your Last.fm activity and profile section (visibility: everyone, friends or me), and whether your listening shows as your activity (showActivity).

Auth
A person's token or an API key, as Authorization: Bearer.
Get an API key

Errors

  • 403Only the person signed in can do this.
curl -X PATCH 'https://api.cactive.com.au/v1/messaging/me/lastfm' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
Send it from this page with your session or a key.

Response 200

{
  account: {
    username: string
    url: string
    verified: boolean
    linkedAt: number
    visibility: "everyone" | "me" | "friends"
    showActivity: boolean
    problem: null | "revoked" | "private" | "not_found"
  }
}
DELETE/v1/messaging/me/lastfm

Unlinks your Last.fm account and deletes its session key.

Auth
A person's token or an API key, as Authorization: Bearer.
Get an API key

Errors

  • 403Only the person signed in can do this.
curl -X DELETE 'https://api.cactive.com.au/v1/messaging/me/lastfm' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
Send it from this page with your session or a key.

Response 204 with no body

POST/v1/messaging/activities

What each of userIds (up to 500) is listening to, for those whose activity you may see (activities: userId, activity with track, artist, album, album art copied into Mirage's files, the track's link, nowPlaying, playedAt); others are left out.

Auth
A person's token or an API key, as Authorization: Bearer.
Get an API key

Errors

  • 403Only the person signed in can do this.
curl -X POST 'https://api.cactive.com.au/v1/messaging/activities' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
Send it from this page with your session or a key.

Response 200

{
  activities: {
    userId: string
    activity: {
      source: "lastfm"
      track: string
      artist: string
      album: null | string
      artUrl: null | string
      trackUrl: null | string
      nowPlaying: boolean
      playedAt: null | number
    }
  }[]
  at: number
}
GET/v1/messaging/users/:userId/lastfm

Someone's listening on their profile, when you may see it: this week's top artists (topArtists: up to ten, most played first, each with name, url and pictureUrl, a copy of the artist's picture or null) and their activity. Never their Last.fm username or play counts.

Auth
A person's token or an API key, as Authorization: Bearer.
Get an API key

Path parameters

  • userId

    A member's user id (usr_…).

Errors

  • 403Only the person signed in can do this.
curl 'https://api.cactive.com.au/v1/messaging/users/{userId}/lastfm' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
Send it from this page with your session or a key.

Response 200

{
  topArtists: {
    name: string
    url: null | string
    pictureUrl: null | string
  }[]
  activity: null | {
    source: "lastfm"
    track: string
    artist: string
    album: null | string
    artUrl: null | string
    trackUrl: null | string
    nowPlaying: boolean
    playedAt: null | number
  }
}