API GET example in Openshift

Solution Verified - Updated -

Issue

  • We have a developer who is working on creating a demo of an application communicating with the OpenShift API. This is from an email thread we have with the sales support team (they advised we submit a case). I think an example would go a long way here. They would like to use PHP or Perl to make the call.

  • We really would prefer to be able to use the REST API than a CLI when programming against this. If the goal here is to prove that we can interface with Openshift with our tool then the API would be the way to go. A CLI would require system calls from our system, which is possible, but not ideal. The API should work, but we get errors when trying to do things like:

create a OAuthAccessToken
POST /oapi/v1/oauthaccesstokens
  • It seems we are forced to use the /oauth/authorize method instead, but it returns HTML. Also, we cannot seem to find any documentation on the /oauth "API" anywhere.

  • Red Hat guys, can you provide some example code (Perl or PHP preferred) of how to make a successful connection via the REST API to get a token and then something simple like listing projects that are defined? There are really no examples in your current documentation that we can find.

Environment

  • OpenShift v3

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content