APEX URL Format

Pretty basic and easy, but still i have a sticky note at my monitor which reminds me of what is what.

A typical APEX URL looks like this:

http://tryapexnow.com/apex/f?p=2500:1:1016153158259880

That means:
open Application 2500 on Page 1 using Session 1016153158259880

But there can be much more…

Most of this stuff here is described very well in the Oracle Application Express Application Builder Users’s Guide, Chapter “Understanding URL Syntax“, nonetheless i try to explain it using my own words.

The complete APEX URL Syntax looks like this:

http://apex.oracle.com/pls/apex/f?p=AppId:PageId:Session:Request:Debug:ClearCache:Params:ParamValues:PrinterFriendly

Let’s take a closer look:

  • http:// – the protocol, can be http or https
  • apex.oracle.com – your domain/host/server, whatever you want to call it. Can also be localhost.
  • /pls – indicates that you are using Oracle HTTP Server with mod_plsql. If you are using APEX Listener or Embedded PL/SQL Gateway this part is obsolete/missing.
  • /apex – the entry from your dads.conf file (this a file on your application-server or EPG where the target database is configured) – in case of EPG its just one entry pointing to localhost, in case of an OAS you can have multiple entries, each pointing to an other database
  • /f?p= – procedure “f” is called and parameter “p” is set to the complete rest of the string. Remember: APEX uses mod_plsql. “f” is a public procedure, this is the main entrypoint for APEX. Or you could say: “f” is APEX.
  • AppId – the number or the Alias of the Application
  • :PageId – the number or the Alias of the Page
  • :Session – unique Session ID, can be 0 for Public Pages or empty (then APEX creates a new Session)
  • :Request – a Request Keyword. This is basically free text, just a string you can specify to react in a process or region condition on. e.g. you could pass the keyword “CREATE” and have a condition on the delete button of your page saying “dont’t display this button if request is CREATE”.
    In other words: use the REQUEST to control the behaviour of your page.
    When pressing a button, the button sets the REQUEST to the button-value (e.g. SAVE), so that you can control the processes in the page processing (Submit) phase.
  • :Debug – set to YES (uppercase!) switches on the Debug-Mode which renders debug-messages and timestamps in your Browser window. This helps to detect wrong behaviour of your page or performance issues and everything else. Every other value then YES turns the Debug-Mode off
  • :ClearCache – you can put a page id or a list of page ids here (comma-separated) to clear the cache for these pages (set session state to null, …). But there is more: RP resets the pagination of reports on the page(s), a collection name deletes the collection, APP clears all pages and application-items, SESSION does the same as APP but for all applications the session-id has been used in.
  • :Parameters – comma seperated list of page-item names. Good practice is to set only those page-items which are on the page you are going to. Accepts page-items as well as application-items.
  • :ParamValues – comma separated list of values. Each value is assigned to the corresponding Parameter provided in ParamNameList (first value assigned to first parameter, second value assigned to second parameter, and so on…).
    The trick here is not having values which contain either a comma “,” or a colon “:”. Both would lead to side-effects and errors, as APEX gets confused when parsing the URL. Using a comma works, if enclosed by slashes: e.g. \123,89\.
  • :PrinterFriendly – set to YES (uppercase!) switches the page into PrinterFriendly-Mode, uses the Printerfriendly template to render the Page. You can also hide regions or other elements in PrinterFriendly-Mode using the PRINTER_FRIENDLY variable in a condition.

There are also some more Blogs dealing with URL Syntax, take a look at some of them: MattsBits, Oraclenerd, Burleson .

Edit: thanks to Alistair Laing who pointed out the typo (wrong slash direction) in escaping the ParamValues. Its fixed now.



  1. Christian Rokitta on June 3, 2010

    Hi Peter,

    I wrote an article on how to use regular URL syntax with APEX. You might want to have a look at it, as it handy with some javascript libraries altering urls sometimes.

    http://rokitta.blogspot.com/2009/07/apex-fp-syntax-with-flexible-parameter.html

    Regards,
    Christian

  2. Peter Raganitsch on June 3, 2010

    Hi Christian,

    i used your flexible f procedure already, works like a charm :-)

    Peter

  3. Scott Wesley on July 4, 2011
  4. Raoul on July 26, 2011

    Hi Peter,

    I tried using this syntax in my query so the query would spit out a rapport with links.

    in the select statement it works but when i try it in a case statement the url doesn’t become a link but is displayed as a string or plain text.

    Do you have any idea why?

  5. Trev on January 17, 2012

    “Using a comma works, if enclosed by slashes: e.g. /123,89/.”

    These should be backslashes, eg: “\123,89\”
    https://forums.oracle.com/forums/thread.jspa?threadID=571476

  6. Scott Wesley on January 18, 2012

    Good spot! I was tripping myself up with the same issue just the other day. Something I “knew” but was remembering incorrectly :-)

  7. Nikunj Patel on May 24, 2012

    This is one of the Best description of APEX URL

    Thank You.

  8. Mike OShields on March 4, 2013

    So I’m kind of a newbie with Apex and I have a question: I have a report which uses a parameter. The report is generated from a SQL statement which uses this parameter (:P2_RBINumber). Normally, I use a combo box on the report that the user uses to choose the RBINumber parameter but I’d like to have this parameter in the URL as an alternative. The report item is RBINUMBER and I’ve tried http://:8090/apex/f?p=103:3:0::::RBINUMBER:13-005: but I get the error “Unable to find item ID for item “RBINUMBER” in application “103″. What am I missing in the URL? I’ve tried shifting the parameter and parameter value to different places but have had no success.

    Thanks

  9. Peter Raganitsch on March 4, 2013

    Mike,

    you can set only Page Items or Application Items using this URL Syntax, you cannot set a Report Column.

    In your example you would set P2_RBINUMBER (please use uppercase with items all the time) via the URL as http://:8090/apex/f?p=103:3:0::::P2_RBINUMBER:13-005: and then use P2_RBINUMBER in your Report Query.

    So far so good.

    In case of an interactive Report you can preset Filters via URL as covered in this Blogpost: http://www.oracle-and-apex.com/set-interactive-report-filter-with-url-parameters/