Skip to main content
mike_bronson7
Gold ⭐️⭐️⭐️
February 12, 2019
Solved

REST API + create an instance of SLIDER view

hi all

we want to create an instance of SLIDER view

103465-capturepng7.png

so we run the following API

curl --user admin:admin -i -H 'X-Requested-By: ambari' -X POST http://localhost:8080/api/v1/views/SLIDER/versions/2.0.0/instances/SLIDER_NEW
HTTP/1.1 400 Bad Request
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Cache-Control: no-store
Pragma: no-cache
Set-Cookie: AMBARISESSIONID=hpxbpzq0m16x1xygqwvbu3340;Path=/;HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
User: admin
Content-Type: text/plain
Content-Length: 527
{
"status" : 400,
"message" : "{\"propertyResults\":{\"ambari.server.password\":{\"valid\":false,\"detail\":\"No property values exist for the required parameter ambari.server.password.\"},\"ambari.server.url\":{\"valid\":false,\"detail\":\"No property values exist for the required parameter ambari.server.url.\"},\"ambari.server.username\":{\"valid\":false,\"detail\":\"No property values exist for the required parameter ambari.server.username.\"}},\"valid\":false,\"detail\":\"The instance has invalid properties.\"}"

but not succeeded

please advice what is wrong with my API?

jsensharma
Platinum ⭐️⭐️
February 12, 2019

@Michael Bronson

Can you please try something like this:

# curl --user admin:admin -i -H 'X-Requested-By: ambari' -X POST -d '{"ViewInstanceInfo":{"instance_name":"SLIDER_NEW","label":"SLIDER_NEW","visible":true,"description":"SLIDER_NEWDescription","properties":{"ambari.server.url":"http://localhost:8080/api/v1/clusters/YOUR_CLUSTER_NAME","ambari.server.username":"admin","ambari.server.password":"admin","slider.user":"admin"},"cluster_type":"NONE"}}' http://localhost:8080/api/v1/views/SLIDER/versions/2.0.0/instances/SLIDER_NEW

.

You will need to make sure to change the Cluster Name "YOUR_CLUSTER_NAME" in the following piece of the JSON data:

"ambari.server.url":"http://localhost:8080/api/v1/clusters/YOUR_CLUSTER_NAME"

.

6 replies

jsensharma
Platinum ⭐️⭐️
Platinum ⭐️⭐️
February 12, 2019

@Michael Bronson

Can you please try something like this:

# curl --user admin:admin -i -H 'X-Requested-By: ambari' -X POST -d '{"ViewInstanceInfo":{"instance_name":"SLIDER_NEW","label":"SLIDER_NEW","visible":true,"description":"SLIDER_NEWDescription","properties":{"ambari.server.url":"http://localhost:8080/api/v1/clusters/YOUR_CLUSTER_NAME","ambari.server.username":"admin","ambari.server.password":"admin","slider.user":"admin"},"cluster_type":"NONE"}}' http://localhost:8080/api/v1/views/SLIDER/versions/2.0.0/instances/SLIDER_NEW

.

You will need to make sure to change the Cluster Name "YOUR_CLUSTER_NAME" in the following piece of the JSON data:

"ambari.server.url":"http://localhost:8080/api/v1/clusters/YOUR_CLUSTER_NAME"

.

Translate
mike_bronson7
Gold ⭐️⭐️⭐️
February 12, 2019

I solved it by

hadoop fs -mkdir /user/slider

Translate
Michael-Bronson
Shelton
Gold ⭐️⭐️⭐️
February 12, 2019

@Michael Bronson

Just create the home directory as follows

# su - hdfs
$ hdfs dfs -mkdir /user/slider
$ hdfs dfs -chown slider:hdfs /user/slider

That should be enough .. good luck

Translate