Apps created with Web AppBuilder can be modified directly with URL parameters. The URL always begins with <your portal url>/apps/webappviewer/index.html? 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:
http://<your portal url>/apps/webappviewer/index.html?id=6815e148ff1c4aee8dc7159816380a4d&webmap=9cf053ea602345ddae060010c470e615
Caution:
Currently 3D apps do not support URL parameters.
Encode the query parameters
All query parameters must be encoded. Encoding replaces invalid characters with % followed by their hex equivalent.
For example, here is an unencoded URL parameter:http://<your portal url>/apps/webappviewer/index.html?find=380 new york street, redlands, ca
Here is the same parameter encoded:http://<your portal url>/apps/webappviewer/index.html?find=380%20new%20york%20street,%20redlands,%20ca
The web has many free sites and tools for generating encoded URLs. For example, Albion Research Ltd. has a URLEncode and URLDecode Page. For readability, the rest of the examples in this topic are not encoded.
Open saved app
To open a saved app created with Web AppBuilder, use id= and the unique ID of the app. For example:
http://<your portal url>/apps/webappviewer/index.html?id=6815e148ff1c4aee8dc7159816380a4d
Define web map
To define the web map, use webmap= and the unique ID of the web map. For example:
http://<your portal url>/apps/webappviewer/index.html?webmap=9cf053ea602345ddae060010c470e615
Center map
To center the map at a particular location, set center= using geographic coordinates (x,y) or projected coordinates (x,y,WKID).
Caution:
You can use commas or semicolons as separators. Use semicolons if your numbers use colons as their decimals
Geographic coordinates example:
http://<your portal url>/apps/webappviewer/index.html?center=34,-50
Projected coordinates example:
http://<your portal url>/apps/webappviewer/index.html?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 map service's REST endpoint. For example:
http://<your portal url>/apps/webappviewer/index.html?center=20,45&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 map service's REST endpoint. For example:
http://<your portal url>/apps/webappviewer/index.html?center=20,45&scale=4622324
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 colons as their decimals.
Geographic coordinates example:
http://<your portal url>/apps/webappviewer/index.html?extent=-117.20,34.055,-117.19,34.06
Projected coordinates example:
http://<your portal url>/apps/webappviewer/index.html?extent=-13079253.954115,3959110.38566837,-12918205.318785,4086639.70193162,102113
Find location of feature to open map
To find a location or feature that's used to open the map, use find=. The map is automatically zoomed to the closest match and a callout marker is added to the map. The find parameter accepts single-line addresses, partial addresses (such as city only or country only), place-names, longitude-latitude coordinates, and features in searchable layers (such as 1916352001 for a Parcel Identification Number (PIN)). For example:
http://<your portal url>/apps/webappviewer/index.html?find=380 new york street, redlands, ca
Caution:
All query parameters must be encoded.
Add point
To add a point to the map, use marker=<x>,<y>. The point is added to the map at the specified x and y location. You can also include the following optional properties:
- <wkid>—Spatial reference of the x,y coordinates added to the map. If you do not include a WKID, GCS coordinates are used.
- <encoded title>—Title of the point pop-up. If you do not include a title, the pop-up will be empty.
- <encoded icon URL>—Symbol for the point. If you do not include a symbol, a blue marker symbol is used.
- <encoded label>—Label next to the point symbol.
The following should be considered:
- <x>,<y> are required.
- Be sure to encode the title, icon, and label parameters.
- You must add properties in this order: marker=<x>,<y>,<wkid>,<encoded title>,<encoded icon URL>,<encoded label>.
- You can use commas or semicolons as separators. Use semicolons if your numbers use colons as their decimals.
- Use empty values. Do not use spaces. For example, if you want to specify a label and none of the other optional properties, add the label as the sixth parameter with empty values for the others (x;y;;;;label).
- If you want the map to zoom in (in addition to centering on the point), include the level= parameter.
For example:
http://<your portal url>/apps/webappviewer/index.html?marker=-79.234826;38.147884;;Race start and finish;;Grindstone 100 Ultra Marathon&level=7
Query feature
To query a feature and zoom to it, you can use one of the following options:
- query=<layer name>,<field name>,<field value>
- query=<layer name>, <where clause>
- query=<layer id>,<field name>,<field value>
- query=<layer id>, <where clause>
Caution:
All of the query parameters are case sensitive and must be encoded.
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.http://<your portal url>/sharing/rest/content/items/32a83775654249dcae6b8f2eff5d4072/data/?f=pjson
For a sublayer in a group of map services, use <layer id_sublayer id> as the layer ID.
Examples:
http://<your portal url>/apps/webappviewer/index.html?id=da80a448ac9246148da0811bddc18c94&query=Census_7501,STATE NAME,California
http://<your portal url>/apps/webappviewer/index.html?id=da80a448ac9246148da0811bddc18c94&query=Census_7501,STATE NAME='California'
http://<your portal url>/apps/webappviewer/index.html?id=da80a448ac9246148da0811bddc18c94&query=Census_7501,POP2000,33871648
http://<your portal url>/apps/webappviewer/index.html?id=da80a448ac9246148da0811bddc18c94&query=Census_7501,POP2000=33871648
Switch locale
To switch the app language, use locale=<language code>. These language codes are supported: ar, cs, da, de, en, el, es, et, fi, fr, he, it, ja, ko, lt, lv, nb, nl, pl, pt-br, pt-pt, ro, ru, sv, th, tr, zh-cn, vi, zh-hk, and zh-tw.
For example:
http://<your portal url>/apps/webappviewer/index.html?locale=fr
Authenticate user
To automatically authenticate a user in a non-public app, use token=<token>. In this way, users do not need to enter their user name and password. For example:
http://<your portal url>/apps/webappviewer/index.html?token=utmVcabc_LNyEQ7OuuHD73em0MErLR_cudJTeSIdMFTnL0poF3shVBeng5ieWHyZn0kAA8nhUg7jseQxz3bi5crnFMMpldDiJLrtzmO3jEM-ZNVIUEh5_qMms-YgXUwGgFbeQlM9WaI3jwraUqwah0yCceBAxEkEIAEWvlBEDfVsYs3LZydORRcs2QIcdLas
Control when to turn on mobile layout
The app supports two styles of layout based on the screen size. One is for desktop and one is for mobile devices. When either the height or width of a screen display is less than 600 pixels, the mobile layout applies automatically. However this may result in unexpected behavior when the app is embedded in a website. For example, the pop up in the website becomes mobile layout style. To control the layout style, use mobileBreakPoint=<pixel number>. For example, you can remain in desktop style until the screen size is less than 300 pixels:
http://<your portal url>/apps/webappviewer/index.html?mobileBreakPoint=300