Search code examples
jsonoraclerestapioracle-ords

How to rename items on oracle rest api using ords


I want to change the name "items" on the json generate by ords on REST API. I want to be the table name or dll instructions like "insert" or "update".

I have the ords installed and runnig. On a module I have the GET: http://localhost:80/ords/db/products/:idTab

When I access the URL the JSON returned like this:

{

    "items": [
        {
            "id_prod": 18159,
            "desc_prod": "ABRAC. \"D\"   1\""
        }
}

I want to replace the items name to the table name (product). How Can I do this on the ords ?

{

    "items": [
        {
            "id_prod": 18159,
            "desc_prod": "ABRAC. \"D\"   1\""
        }
}

Solution

  • You can't.

    Oracle has a REST standard, which dictates the JSON response format you see for a collection using that "items" structure.

    If you want something else, you would need to create the the JSON yourself, and return the output as a media resource (clob or blob) with a mime type as application-json => when you do that, we don't convert the output to JSON.

    enter image description here

    Example here.