How to get Images from ORACLE REST Web Service ?
Oracle REST APIs provides the feature of media resource, here we can write the query with two columns content type and image blob.
While i was trying to implement i saw tweaks, the query has to be in below format only.
SELECT 'content_type',
column
FROM . . .[TABLE]
So now we need one table holding images with their format types and rest enabled APEX environment.
SELECT mimetype, product_image
FROM demo_product_info
WHERE product_id= :product_id;
NOTE: Content type must be first column.
Table structure:
CREATE TABLE "DEMO_PRODUCT_INFO"
( "PRODUCT_ID" NUMBER NOT NULL ENABLE,
"PRODUCT_NAME" VARCHAR2(50),
"PRODUCT_DESCRIPTION" VARCHAR2(2000),
"PRODUCT_IMAGE" BLOB,
"MIMETYPE" VARCHAR2(255),
"FILENAME" VARCHAR2(400),
"IMAGE_LAST_UPDATE" TIMESTAMP (6) WITH LOCAL TIME ZONE,
"TAGS" VARCHAR2(4000),
CONSTRAINT "DEMO_PRODUCT_INFO_PK" PRIMARY KEY ("PRODUCT_ID")
USING INDEX ENABLE,
CONSTRAINT "DEMO_PRODUCT_INFO_UK" UNIQUE ("PRODUCT_NAME")
USING INDEX ENABLE
)
/
API Setup.
- Create module for the API.
- Create Template
- Create GET Handler.
- Create Parameter for product_id.
Try URL:
https://apex.oracle.com/pls/apex/ashish_portfolio/image_id?product_id=100
https://apex.oracle.com/pls/apex/doctor_app/img/image/81