How to use PostMan to check Predix Service

Copy from https://vyatkins.wordpress.com/2016/02/04/cloud-foundry-starter-guid-for-predix-io/

Update a client

uaac client update client_name –scope  acs.attributes.write,acs.policies.read,acs.policies.write,acs.attributes.read

After client update to refresh cache by next command
$ uaac token delete

If you need to change password of your client  you need to add password.write permission in scope and authorities of the client.

$ uaac secret change -h
secret change        Change secret for authenticated client in current context
–old_secret , current secret
-s | –secret , client secret

How to use PostMan to check Predix Service 

Time Series Service

Get a oauth token

OathCallForToken

Use uaa url from app environment field “issuerId” and added headers: Content-Type: application/x-www-form-urlencoded and Authorization: Basic

When you have authorization token post request to the Predix service like Time Series below

PostTimeSeriesRequest

Get Predix-Zone-Id value from app environment field and added Bearer before the token in Authorization header value.

A body of the request may contain next values;

Request body
{
    "start": "15d-ago",
    "end": "1mi-ago",
    "tags": [
             {
              "name": "RMD_metric1"
             }
      ]
}

Asset Management Service

Post
asmPostLocomotive

GetasmGetLocomotive

Get with filter and field with complex json

https://predix-asset.run.aws-usw02-pr.ice.predix.io/windturbine?filter=location.lat=37.767*

Screen Shot 2016-05-12 at 10.09.42 AM

Patch

Patch body
[
  { "op" :"replace",
    "path" : "/serial_no",
    "value":"N123-0857";}
]

“op” – operation
“path” – field name (in our case serial_no)
“value” – new value for serial number for locomotive with uri – /locomotives/1

for more details please check RFC 6902 JavaScript Object Notation (JSON) Patch for

Patch operations examples
[
 { "op": "test", "path": "/a/b/c", "value": "foo" },
 { "op": "remove", "path": "/a/b/c" },
 { "op": "add", "path": "/a/b/c", "value": [ "foo", "bar" ] },
 { "op": "replace", "path": "/a/b/c", "value": 42 },
 { "op": "move", "from": "/a/b/c", "path": "/a/b/d" },
 { "op": "copy", "from": "/a/b/d", "path": "/a/b/e" }
]

Screen Shot 2016-05-07 at 6.45.56 PM

Get after patch

Screen Shot 2016-05-07 at 6.47.31 PM

Delete
asmDeleteLocomotive

How to run Scala “Hello World” program on Predix.io

Check that you have sbt on your computer with Java 7.

If not install sbt using

brew install sbt

$ git clone https://github.com/SVyatkin/hello-scala.git

$ sbt clean package

$ cf push

$ curl hello-scala.run.aws-usw02-pr.ice.predix.io

Scala Hello World Example on Predix.io

Useful links:
Cloud Foundry Docs

 

About eagle081183

Passionate, Loyal
This entry was posted in Knowledge, Problem solving, Software architecture. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s