Showing posts with label REST. Show all posts
Showing posts with label REST. Show all posts

Tuesday, May 10, 2016

#502 IaaS --> Compute Service REST API via Postman

So again, I first need to authenticate, before I can execute any REST requests of import.



curl -i -X POST -H "Content-Type: application/oracle-compute-v3+json" -d '{"user":"/Compute-YourIdentityDomain/YourUser","password":"YourPwd"}' https://YourRESTEndpoint/authenticate/

Here is the request/response in Postman -

























































We are interested in the X-Oracle-Compute-Call-Id

X-Oracle-Compute-Call-Id →1605106c8e1eb8d2129191bd53539248a18d0b


Now I use this in the subsequent request(s)

Here I list the Instances -

https://YourRESTEndpoint/instance/Compute-YourIdentityDomain/YourUser/






















Get the image list - this will return the image I cloned in a previous post.


https://YourRESTEndpoint/imagelist/Compute-YourIdentityDomain/YourUser/


























Get the list of shapes - note the format of this request -


https://YourRESTEndpoint/shape/



















Friday, May 6, 2016

#499 IaaS --> REST apis

Introduction


To begin with, REST api docs are here

I suggest you go thru them first.

To perform operations on an Oracle Compute Cloud Service resource by using
REST API calls, you must specify the fully-qualified, unique URI of the resource.

Let's go back to my Compute Service -













Under Details, I find the REST Endpoint (api endpoint) - yes, I have obfuscated this somewhat!

REST request format is as follows -

https ://{ api_endpoint}/{resource_base_path}/{resource_name}

resource_name is broken down into -
/Compute-{identity_domain}/{user}/{object_id}

So to a simple example -

Authenticate user

curl -i -X POST -H "Content-Type: application/oracle-compute-v3+json" -d '{"user":"/Compute-yourIdentityDomain/yourUser","password":"yourPwd"}' yourAPIEndpoint/authenticate/


















This cookie is then used in all subsequent requests.

Set an env variable as follows to leverage the cookie.













Retrieve the names of my instances in the container

From previous posts you will remember I have NCVM1 and NCVM2

Here is the curl cmd -

curl -X GET -H "Cookie: $COMPUTE_COOKIE" -H "Accept: application/oracle-compute-v3+directory+json" https://YourRESTApiEndpoint/instance/Compute-yourIdentityDomain/yourUser/
















Thursday, February 18, 2016

#477 REST enabled Oracle Database Cloud Service - my first experiences

I have heard that APEX supports REST so I decided to try this out on my SOA CS environment's
DB CS instance. AS per usual, I studiously avoided reading any documentation.
This should be simple, right?


I created a simple table Customers -











Now, as luck would have it I locked my ADMIN APEX user out.

This I fixed as follows -

ssh into the DB CS machine
start sqlplus

conn system/yourPwd@yourSOADB;

alter session set current_schema = APEX_050000;

select user_id, substr(user_name, 1,10), account_locked from wwv_flow_fnd_user;

update APEX_050000.WWV_FLOW_FND_USER
set web_password = 'yourNewPassword'
where user_name = 'ADMIN'
and user_id = yourUserId;
commit;
/

begin
wwv_flow_security.g_security_group_id := 10;
wwv_flow_fnd_user_api.UNLOCK_ACCOUNT('ADMIN');
commit;

end;

Then I logged into APEX and created a new workspace.
I then logged into this workspace -

I then clicked on SQL Workshop - RESTful Service -





























As you can see, the request is based on the simple query -
Select custname from customers

Click on the Test button to get the URL

https://yourIPAddress/ords/yourDB/yourAPEXWorkspace/niall/customers

I now try this out in Postman -


















I can now create a connection to this REST service in ICS.

For ICS, I create a variation of the above -

https://yourIPAddress/ords/yourDB/yourAPEXWorkspace/niall/customer/1

This REST request retrieves customer name based on custId.

Here is the result, when I test in Postman.










I create a REST connection in ICS based on the above.

See my blog post here  for the steps.


Good article on DB CS REST here


Thursday, October 29, 2015

#452 - Useful post on JWT (JSON Web Tokens)

What with all this REST enablement, JWT knowledge is essential.

check out this blog post  here

Monday, October 6, 2014

#338 SOA 12c --> testing REST enabled services in your browser

I have exposed a simple BPEL process via Service Bus -








I can test the RestService in JDev easily -














But how about testing this with just the browser URL?

Easy, as well.

I first edit the REST Service -














I edit the operation bindings -




















I then generate a sample URL for the operation.



















I am using 12c Quickstart so host and port is
localhost:7101

The proxy-uri is a concatenation of JDev project name and Proxy Service name.




















So, in my case, this will be

/SB-Kista5/RestService/

all together, we get -

http://localhost:7101/SB-Kista5/RestService/checkOrder?input=Order1

All the BPEL process does is echo the input -
here is a test result.









You can also find the URI via SBConsole -