Apps created with the Sweet Application Builder can be launched directly with URL parameters.

The URL always begins with /index.html?appid=<applicationID>&instanceclientid=clientid and includes one or more of the parameters listed below.

To include more than one parameter, use an ampersand (&) to separate the parameters. For example:

https://..../{{deployfoldername}}/index.html?appid=&lt;appid>&amp;instanceclientid=&lt;clientid>&amp;panel=feedback

Encode the query parameters

In order to create a valid encode URL for the browser all query parameters must be encoded. Encoding replaces invalid characters (e.g. ; , $ , : , <whitespace> ) in the URL string with % followed by their hexadecimal equivalent.

Here is an unencoded URL parameter:

https://example.com/?luck=10%&amp;skill=20%&amp;powerofwill= fifteen percent'

Here is the same parameter encoded:

https://example.com/?luck=10%25&amp;skill=20%25&amp;powerofwill=%20fifteen%20percent

The web has many free sites and tools for generating encoded URLs. For readability, the rest of the examples in this topic are not encoded.

You can use commas or semicolons as separators for number ranges. Use semicolons if your numbers use commas as their decimals.

Centre map

To centre the map at a particular location, set center= using geographic coordinates (x,y) or projected coordinates (x,y,WKID).

Geographic coordinate example

https://..../sweet/index.html?....&amp;center=34,-50

Projected coordinate example

https://..../sweet/index.html?....&amp;center=500000,5500000,102100

Define scale level

To define the scale level of the map, use the center= and level= parameters. The level parameter accepts the level ID of the cache scale as listed in the basemap service’s REST endpoint. For example:

https://..../sweet/index.html?....&amp;level=4

Define scale

To define the scale of the map, use the center= and scale= parameters. The scale parameter accepts the cache scale as listed in the basemap service’s REST endpoint. For example:

https://..../sweet/index.html?....&amp;scale=462234

Define extent

To define the extent of the map, use extent=. The extent parameter accepts geographic coordinates (GCS) as MinX,MinY,MaxX,MaxY or projected coordinates (PCS) as MinX,MinY,MaxX,MaxY,WKID. You can use commas or semicolons as separators. Use semicolons if your numbers use commas as their decimals.

Geographic coordinate example

https://..../sweet/index.html?....&amp;extent=-117.20,34.055,-117.19,34.06

Projected coordinate example

https://..../sweet/index.html?....&amp;extent=-13079253.954115,3959110.38566837,-12918205.318785,4086639.70193162,102113

Open panel

Opens Sweet with a specific left hand panel open. The available panels are: feedback, messages, selection, basemaps, plans, layers, find, attributes and selection.

https://..../sweet/index.html?....&amp;panel=feedback

Switch locale

To switch the app language, use locale= . These language codes are supported: en, fr, de, cy, nl, es, ja, ko, nb, sv, he and da.

https://..../sweet/index.html?....&amp;locale=fr

Query feature(s)

To query feature(s) and zoom to them, you can use one of the following options:

query=&lt;layer name>,&lt;field name>,&lt;field value>
query=&lt;layer name>,&lt;where clause>
query=&lt;layer id>,&lt;field name>,&lt;field value>
query=&lt;layer id>,&lt;where clause>

Since the layer name can be changed, it is strongly recommended that you use the layer ID in the query. You can retrieved the layer ID from the web map ID as shown below.

Examples

1. Query with layer name and SQL where clause:

https://..../sweet/index.html?....&amp;query=Site Cover,TypeOfLand,'BLD'

2. Query with layer ID, field name and field value:

https://..../sweet/index.html?....&amp;query=f1a15ba6-97aa-4016-8046-02b2ee10f00f,TypeOfLand,BLD

The URL parameter must be encoded correctly. The examples above are shown for syntax reference only and must be URL encoded before use.

Select feature(s)

To select features and zoom to them, you can use one of the following options:

select=query
select=&lt;layer name>,&lt;field name>,&lt;field value>
select=&lt;layer name>,&lt;where clause>
select=&lt;layer id>,&lt;field name>,&lt;field value>
select=&lt;layer id>,&lt;where clause>

Since the layer name can be changed, it is strongly recommended that you use the layer ID in the query. You can retrieved the layer ID from the web map ID as shown below.
If the query word is used, then the results from the query parameter will automatically be selected.

Examples

https://..../sweet/index.html?....&amp;select=Site Cover,TypeOfLand,'BLD'
https://..../sweet/index.html?....&amp;select=SiteCover_f1a15ba6,TypeOfLand='BLD'
https://..../sweet/index.html?....&amp;query=Site Cover,TypeOfLand='BLD'&amp;select=query

The URL parameter must be encoded correctly. The examples above are shown for syntax reference only and must be URL encoded before use.

Authenticate user

To automatically authenticate a user in a non-public app, use token=. A token can be generated for your portal via the ArcGIS REST API or through the Python API for ArcGIS.

In this way, users do not need to enter their user name and password. For example:

https://..../sweet/index.html?....&amp;token=utmVcabc_LNyEQ7OuuHD73em0MErLR_cudJTeSIdMFTnL0poF3shVBeng5ieWHyZn0kAA8nhUg7jseQxz3bi5crnFMMpldDiJLrtzmO3jEM-ZNVIUEh5_qMms-YgXUwGgFbeQlM9WaI3jwraUqwah0yCceBAxEkEIAEWvlBEDfVsYs3LZydORRcs2QIcdLas

Session variables

To change the default values shown in the session variables dialog at start-up or to create new session variables that your scripts can use, you can use the variables= parameter. With this parameter you must pass in a JSON object for your parameters. If the object has a parameter with the same name as a variable, its default value will change. If it is a new parameter, a new variable will be created in the application for use by scripts. For example:

https://..../sweet/index.html?....&amp;variables={"myparam1":"Hello World", "myparam2":"Hello World 2"}

The URL parameter must be encoded correctly. The examples above are shown for syntax reference only and must be URL encoded before use.