Skip to main content

One post tagged with "API"

API documentation for FaynoSync

View All Tags

Fetch Latest Version of App โ€” Smart Update Links

ยท 3 min read

Ever needed to share a download link that always points to the latest version of your app? Or wanted to set up automatic updates for your users? The Fetch latest version of app endpoint is your perfect solution! Let's explore how it works with some real-world examples.


Meet Our Example App ๐ŸŽฎโ€‹

Let's imagine we have an app called "SpaceExplorer" with the following setup:

Channels:โ€‹

  • ๐Ÿš€ stable - Production releases
  • ๐Ÿงช beta - Testing versions
  • ๐ŸŒ™ nightly - Daily builds

Platforms & Architectures:โ€‹

  • ๐Ÿ’ป Linux (amd64, arm64)
  • ๐ŸŽ macOS (amd64, arm64)
  • ๐ŸชŸ Windows (amd64)

Package Types:โ€‹

  • ๐Ÿ“ฆ .deb (Linux)
  • ๐Ÿ“ฆ .rpm (Linux)
  • ๐Ÿ“ฆ .dmg (macOS)
  • ๐Ÿ“ฆ .exe (Windows)

Let's Fetch Some Versions! ๐ŸŽฏโ€‹

Example 1: Simple Latest Versionโ€‹

GET /apps/latest?app_name=SpaceExplorer&owner=admin

This basic request returns ALL available builds:

{
"stable": {
"linux": {
"amd64": {
"deb": { "url": "..." },
"rpm": { "url": "..." }
},
"arm64": {
"deb": { "url": "..." },
"rpm": { "url": "..." }
}
},
"darwin": {
"amd64": { "dmg": { "url": "..." } },
"arm64": { "dmg": { "url": "..." } }
},
"windows": {
"amd64": { "exe": { "url": "..." } }
}
},
"beta": {
// Similar structure for beta builds
},
"nightly": {
// Similar structure for nightly builds
}
}

Example 2: Specific Channelโ€‹

GET /apps/latest?app_name=SpaceExplorer&channel=stable&owner=admin

Now we get only stable builds:

{
"stable": {
"linux": {
"amd64": {
"deb": { "url": "..." },
"rpm": { "url": "..." }
}
// ... other architectures
}
// ... other platforms
}
}

Example 3: Platform-Specificโ€‹

GET /apps/latest?app_name=SpaceExplorer&channel=stable&platform=linux&owner=admin

Only Linux builds:

{
"stable": {
"linux": {
"amd64": {
"deb": { "url": "..." },
"rpm": { "url": "..." }
},
"arm64": {
"deb": { "url": "..." },
"rpm": { "url": "..." }
}
}
}
}

Example 4: Exact Matchโ€‹

GET /apps/latest?app_name=SpaceExplorer&channel=stable&platform=linux&arch=amd64&package=deb&owner=admin

This returns a direct download URL:

https://<bucket_name>.s3.amazonaws.com/SpaceExplorer/stable/linux/amd64/SpaceExplorer-1.2.3.deb

Smart Features ๐Ÿง โ€‹

  1. Automatic Redirection ๐Ÿ”„

    • If only one build matches your criteria, you'll get redirected straight to the download
    • Perfect for landing pages and direct download links
  2. Flexible Responses ๐ŸŽฏ

    • Get all available builds
    • Filter by channel
    • Filter by platform
    • Filter by architecture
    • Filter by package type

Real-World Use Cases ๐ŸŒโ€‹

1. Landing Page Downloadsโ€‹

<!-- For Linux users -->
<a href="/apps/latest?app_name=SpaceExplorer&platform=linux&arch=amd64&package=deb&owner=admin">
Download for Linux (.deb)
</a>

<!-- For macOS users -->
<a href="/apps/latest?app_name=SpaceExplorer&platform=darwin&arch=arm64&package=dmg&owner=admin">
Download for macOS (.dmg)
</a>

2. Team Testingโ€‹

# For beta testers
GET /apps/latest?app_name=SpaceExplorer&channel=beta&platform=darwin&arch=arm64&package=dmg&owner=admin

# For nightly build enthusiasts
GET /apps/latest?app_name=SpaceExplorer&channel=nightly&platform=linux&arch=amd64&package=deb&owner=admin

What's Next? ๐Ÿš€โ€‹

In our next posts, we'll explore:

  • Performance optimization tips

Stay tuned for more faynoSync tips and tricks! ๐Ÿ’š


How to try faynoSync?โ€‹

  1. Follow the Getting Started guide:
    ๐Ÿ‘‰ https://ku9nov.github.io/faynoSync-site/docs/category/getting-started

  2. Create your app using the REST API or web dashboard:
    ๐Ÿ“ฆ API Docs: https://ku9nov.github.io/faynoSync-site/docs/api
    ๐Ÿ–ฅ๏ธ Dashboard UI: https://github.com/ku9nov/faynoSync-dashboard

  3. Upload at least two versions of your application.

  4. Check for updates with this simple request:
    ๐Ÿ“ก /info/latest


If you find this project helpful, please consider subscribing, leaving a comment, or giving it a star, create Issue or feature request on GitHub.
Your support keeps the project alive and growing ๐Ÿ’š