<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "AppStream.ent">
%BOOK_ENTITIES;
]>

<section id="sect-AppStream-Misc-URIHandler">
	<title>URI Handler</title>

	<section id="spec-asuri-introduction">
		<title>Introduction</title>
		<para>
			In order to allow installation of AppStream components from websites, software-centers implementing AppStream
			may choose to also support the <literal>appstream:</literal> URIs.
		</para>
		<para>
			This allows upstream projects to trigger an installation of their application from their homepage on any supporting
			distribution.
			It also is helpful for web-based software-centers.
		</para>
	</section>

	<section id="spec-asuri-schema">
		<title>URI schema</title>
		<para>
			Software centers handling <literal>appstream:</literal> URIs should provide a handler for the <literal>x-scheme-handler/appstream</literal>
			mimetype.
			An AppStream URI follows the schema <code>appstream:%{component-id}</code>.
		</para>
		<para>
			If a component is known by multiple alternative IDs, more component IDs may be defined in a comma-separated list in the query component
			of the URI using the <code>alt</code> key. This may be necessary if an application has switched its ID, but the same URI may be called on systems
			which still only know the old ID.
			Software centers must try to find the initial ID first and, failing to find it in their catalog, may try the alternative IDs in order of appearance
			in the query.
		</para>
		<para>
			Example HTML code:
		</para>
		<programlisting language="HTML"><![CDATA[<a href="appstream:org.kde.discover.desktop">Install KDE Discover</a>
<a href="appstream:org.gnome.Software.desktop">Install GNOME-Software</a>
<a href="appstream:org.freedesktop.appstream.cli">Install AppStreamCLI</a>
<a href="appstream:org.example.foo?alt=com.github.darthvader.foo,net.launchpad.vader.foo">Install Foo</a>]]></programlisting>
	</section>

	<section id="spec-asuri-button">
		<title>AppStream Buttons</title>
		<para>
			If you want to allow users to open your software in their local software center from your website, you might want to use
			one of the easily recognizable AppStream buttons for your <code>appstream:</code> link.
		</para>
		<mediaobject>
			<imageobject>
				<imagedata fileref="appstream-button1.svg" />
			</imageobject>
			<caption>
				<para>
					<ulink url="https://github.com/ximion/appstream/blob/master/docs/images/src/svg/appstream-button1.svg">SVG</ulink>
				</para>
			</caption>
		</mediaobject>
		<mediaobject>
			<imageobject>
				<imagedata fileref="appstream-button2.svg" />
			</imageobject>
			<caption>
				<para>
					<ulink url="https://github.com/ximion/appstream/blob/master/docs/images/src/svg/appstream-button2.svg">SVG</ulink>
				</para>
			</caption>
		</mediaobject>
	</section>
</section>
