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.

14 thoughts on “APEX URL Format

  1. 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?

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

  3. This is one of the Best description of APEX URL

    Thank You.

  4. 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

  5. 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/

  6. Nice Job, Pavel,

    Just some ideas to enhance it:
    – switch Page/App field, move &APP_ALIAS
    – support LEVEL1..LEVEL9 in Debug
    – have IR-Filtering Support for Parameters-Section

    Thanks

  7. How does it deal with checksum? Just learning Apex and having trouble with how to add this to URL. Is there an alias for checksum?

  8. Thanks that you replied.

    I needed to get a drill down link from a chart to open in a new window but I got stumped at a few things like how to catch the event of clicking on a pie chart. I did try out this for creating the link:

    Select APEX_UTIL.PREPARE_URL (‘f?p=&APP_ID.:&APP_PAGE_ID.:&APP_SESSION.::NO::P522_STATUS,P0_RETURN_PAGE,P522_TODAY_ONLY:&P522_STATUS.,&P0_RETURN_PAGE.,FALSE’,’_blank’) link from dual;

    but it did not have the checksum on the end and I kept getting the no checksum error on opening the page. What am I actually missing?.

Leave a Reply

Your email address will not be published. Required fields are marked *