You can link to Perforce depot information from within your own HTML documents by constructing URLs that direct P4Web to return specified data. Such URLs can be used in email, in web pages (static or CGI-generated), and in any context where URLs are useful. You can create scripts that construct such URLs and pass them to a Web browser, enabling users to display Perforce information without requiring them to install Perforce client applications on their computer. Some simple examples: |
Display the depot root for the specified server | http://myp4web:8080/ |
List the executable files in a specified folder | |
http://myp4web:8080//depot/www/sitemap.html@2004/1/1 |
The syntax for P4Web URLs is as follows:
P4Web uses a variety of other elements in the URLs that it constructs, but you can omit these elements in the URLs that you construct for your queries. The basic elements of the URL are as follows. |
Element |
Description |
http://p4webhostname:port/ | Specifies the P4Web server and port |
@parameters@ | List of parameters, delimited by "@" (optional) |
//depot_path/ | Path to file or folder |
@revision_number |
|
?ac=n | Action code |
?argument=value | Argument/value pairs, each preceded by "?" |
The following table lists the action codes that are supported for queries.
Type |
Description |
Action
|
Branches |
Display view for a specified branch specification Example: http://myp4web:8080/talkhouse1.0?ac=14 |
14 |
Compare branched source and target files listed in a branch specification Example: http://myp4web:8080/talkhouse1.0?ac=126 |
126 | |
List branch specifications Example: http://myp4web:8080/?ac=82 |
82 | |
Changelists |
Display submitted changelists containing specified file Example: http://myp4web:8080//depot/Jam/MAIN/src/Build.com?ac=69 |
69 |
List all submitted changelists for specified path Example: http://myp4web:8080//depot/Talkhouse/rel1.0/?ac=43 |
43 | |
Display fixes for a specified changelist Example: http://myp4web:8080/799?ac=133 |
133 | |
Display detail for specified changelist Example: http://myp4web:8080/799?ac=10 |
10 | |
Diffing |
Diff two file revisions Example: http://myp4web:8080/@md=c&cd=//depot/main-dev/@//depot/main-dev/EBolt.java?ac=19&rev1=1&rev2=2 |
19 |
Files |
List files in specified path matching specified pattern (including wildcards) Example: http://myp4web:8080/@&pat=*.java@//depot/Talkhouse/main-dev/?ac=30 |
30 |
Display P4Web pattern-matching page Example: http://myp4web:8080/?ac=61 |
61 | |
Display file according to its mime type Example: http://myp4web:8080//depot/www/dev/images/jamgraph-jam.gif?ac=98 |
98 | |
Display head revision of file as text Example: http://myp4web:8080//depot/www/dev/index.html?ac=64 |
64 | |
Print file contents to browser Example: http://myp4web:8080//depot/www/dev/index.html?ac=18 |
18 | |
Display file according to its mime type Example: http://myp4web:8080//depot/www/dev/index.html?ac=106 |
106 | |
Display annotated file text Example: http://myp4web:8080//depot/www/dev/index.html?ac=143 |
143 | |
Display revision history Example: http://myp4web:8080////depot/main/ProjectX/Help/roadmap.html?ac=22 |
22 | |
Display depot tree for specified path Example: http://myp4web:8080//depot/www/dev/?ac=83 |
83 | |
Jobs |
List jobs Example: http://myp4web:8080//?ac=107 |
107 |
Display job detail Example: http://myp4web:8080/job000018?ac=111 |
111 | |
Display changelists that fix a specified job Example: http://myp4web:8080/job000018?ac=135 |
135 | |
Display the job specification Example: http://myp4web:8080/?ac=130 |
130 | |
Labels |
List files in a specified label Example: http://myp4web:8080/jam-1.1.0?ac=118 |
118 |
List labels Example: http://myp4web:8080//?ac=77 |
77 | |
Display detail for a specified label Example: http://myp4web:8080/jam-1.1.0?ac=16 |
16 | |
List labels that contain files in a specified path Example: http://myp4web:8080//depot/www/dev/?ac=127 |
127 | |
Misc |
Cancel your currently-running command Example: http://myp4web:8080//?ac=144 |
144 |
Reporting |
Display file view of server positioned to root (//) Example: http://myp4web:8080//depot/?ac=71 |
71 |
Show status of specified file Example: http://myp4web:8080//depot/Jam/MAIN/src/Build.com?ac=104 |
104 | |
List all open files (all workspaces) Example: http://myp4web:8080//?ac=62 |
62 | |
Display server and P4Web version info Example: http://myp4web:8080//?ac=151 |
151 | |
Users |
Display details for specified user Example: http://myp4web:8080/bruno?ac=17 |
17 |
List users Example: http://myp4web:8080//?ac=81 |
81 |
P4Web uses a variety of parameters in the URLs it constructs. Many of the parameters are for internal use and are not relevant for scripting. To construct the precise URL for the information you seek, browse using P4Web until you have the desired results displayed, then copy the URL from the address bar and use it as the basis to construct your own URL. Commonly-used parameters are as follows. |
Parameter |
Description |
&cd=path | Path to a folder |
&nx=n | Maximum number of items to display |
&pat=file_matching_pattern | Wildcard expression for matching a set of files |
&sr=@revision_specifier | A Perforce revision specifier (revision number, label, date, or changelist number) |