Testing HTTP GETs is relatively easy. You can simply put the address in your browser and go.

Testing a POST or PUT is a bit more challenging – you may need to supply headers and/or a content body on the request.

Oracle SQL Developer Web does make this possible today, but I haven’t really talked about it in depth.

Using the OpenAPI View

I published a ‘definitive example’ for how to INSERT a row to an Oracle TABLE using a REST API awhile back.

And in that post I was using a REST Client like Insomnia.

Postman would do the same, more or less.

But what if I never want to leave the confines of my browser? I’m writing code, now I want to test said code!

From the REST workshop, on the Modules page, simply click the kebab button, and choose ‘OpenAPI View’

Yes, this is called a kebab. If those were lines instead of dots, it’s be a hamburger.
Our templates and handlers…

Let’s look at the POST

The ‘Try it out’ button is what we want to do.

Our endpoint requires headers and an optional payload, or body.
So I’ll put in some values…the body can be ANY valid JSON.

And we’ll click the Execute button, and voila:

Here’s the equivalent cURL, and here’s what the API returned, nicely formatted for me.

Let’s test the DELETE, too

I didn’t actually have a DELETE, so I’ll just add a DELETE handler to my /tables/emps/:id template, with the following SQL:

delete from emps where id = :id

And coming back to our OpenAPI view –

DELETE the item, 200. Now try to GET it, 404.

I'm a Distinguished Product Manager at Oracle. My mission is to help you and your company be more efficient with our database tools.

Write A Comment

Follow by Email