You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ranger.apache.org by Hafiz Mujadid <ha...@gmail.com> on 2015/08/09 11:29:58 UTC
rest api create policy giving 404 error
Hi Experts!
I tried this command to create a new policy
curl -i --header "Accept:application/json" -H
"Content-Type:application/json" --user admin:admin -X POST
http://122.129.79.69:6080/service/public/api/policy -d '{
"policyName":"hdt",resourceName:"/test","description":"curl","repositoryName":"hdfs-repo","repositoryType":"hdfs","permMapList":[{"userList":["mujadid"],"permList":["Read"]},{"groupList":["internal"],"permList":["Read"]}],"isEnabled":true,isRecursive:true,"isAuditEnabled":true,"version":"1","replacePerm":false}'
But it is giving following response
HTTP/1.1 404 Not Found
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=66399D5EE5D1859A293C467C0D300F87; Path=/; HttpOnly
Content-Length: 0
Date: Sun, 09 Aug 2015 09:11:49 GMT
Re: rest api create policy giving 404 error
Posted by Hafiz Mujadid <ha...@gmail.com>.
Thanks Alok, I succeeded after correcting json :)
On Tue, Aug 11, 2015 at 3:33 AM, Alok Lal <al...@hortonworks.com> wrote:
> Hafiz,
>
> Is this still an issue or you were good after you corrected the json
> command?
>
> You could use the following slightly modified curl command. Either it
> would succeed or it’ll point you to the validation error that you are
> running into.
>
> curl -H "Accept: application/json" -H "Content-Type: application/json" -u
> admin:admin --data '{
> "policyName":"hdt","resourceName":"/test","description":"curl","repositoryName":"hdfs-repo","repositoryType":"hdfs","permMapList":[{"userList":["mujadid"],"permList":["Read"]},{"groupList":["internal"],"permList":["Read"]}],"isEnabled":true,"isRecursive":true,"isAuditEnabled":true,"version":"1","replacePerm":false}'
> http://122.129.79.69:6080/service/public/api/policy
>
> Alok
>
> From: Hafiz Mujadid
> Reply-To: "user@ranger.incubator.apache.org"
> Date: Sunday, August 9, 2015 at 6:12 AM
> To: "user@ranger.incubator.apache.org"
> Subject: Re: rest api create policy giving 404 error
>
> Hi sorry i was mistaking in json
>
> here is my correct command
>
> curl -i --header "Accept:application/json" -H
> "Content-Type:application/json" --user admin:admin -X POST
> http://122.129.79.69:6080/service/public/api/policy -d '{
> "policyName":"hdt","resourceName":"/test","description":"curl","repositoryName":"hdfs-repo","repositoryType":"hdfs","permMapList":[{"userList":["mujadid"],"permList":["Read"]},{"groupList":["internal"],"permList":["Read"]}],"isEnabled":true,"isRecursive":true,"isAuditEnabled":true,"version":"1","replacePerm":false}'
>
> On Sun, Aug 9, 2015 at 2:29 PM, Hafiz Mujadid <ha...@gmail.com>
> wrote:
>
>> Hi Experts!
>>
>> I tried this command to create a new policy
>> curl -i --header "Accept:application/json" -H
>> "Content-Type:application/json" --user admin:admin -X POST
>> http://122.129.79.69:6080/service/public/api/policy -d '{
>> "policyName":"hdt",resourceName:"/test","description":"curl","repositoryName":"hdfs-repo","repositoryType":"hdfs","permMapList":[{"userList":["mujadid"],"permList":["Read"]},{"groupList":["internal"],"permList":["Read"]}],"isEnabled":true,isRecursive:true,"isAuditEnabled":true,"version":"1","replacePerm":false}'
>>
>>
>> But it is giving following response
>>
>> HTTP/1.1 404 Not Found
>> Server: Apache-Coyote/1.1
>> Set-Cookie: JSESSIONID=66399D5EE5D1859A293C467C0D300F87; Path=/; HttpOnly
>> Content-Length: 0
>> Date: Sun, 09 Aug 2015 09:11:49 GMT
>>
>>
>>
>>
>
>
> --
> Regards: HAFIZ MUJADID
>
--
Regards: HAFIZ MUJADID
Re: rest api create policy giving 404 error
Posted by Alok Lal <al...@hortonworks.com>.
Hafiz,
Is this still an issue or you were good after you corrected the json command?
You could use the following slightly modified curl command. Either it would succeed or it’ll point you to the validation error that you are running into.
curl -H "Accept: application/json" -H "Content-Type: application/json" -u admin:admin --data '{ "policyName":"hdt","resourceName":"/test","description":"curl","repositoryName":"hdfs-repo","repositoryType":"hdfs","permMapList":[{"userList":["mujadid"],"permList":["Read"]},{"groupList":["internal"],"permList":["Read"]}],"isEnabled":true,"isRecursive":true,"isAuditEnabled":true,"version":"1","replacePerm":false}' http://122.129.79.69:6080/service/public/api/policy
Alok
From: Hafiz Mujadid
Reply-To: "user@ranger.incubator.apache.org<ma...@ranger.incubator.apache.org>"
Date: Sunday, August 9, 2015 at 6:12 AM
To: "user@ranger.incubator.apache.org<ma...@ranger.incubator.apache.org>"
Subject: Re: rest api create policy giving 404 error
Hi sorry i was mistaking in json
here is my correct command
curl -i --header "Accept:application/json" -H "Content-Type:application/json" --user admin:admin -X POST http://122.129.79.69:6080/service/public/api/policy -d '{ "policyName":"hdt","resourceName":"/test","description":"curl","repositoryName":"hdfs-repo","repositoryType":"hdfs","permMapList":[{"userList":["mujadid"],"permList":["Read"]},{"groupList":["internal"],"permList":["Read"]}],"isEnabled":true,"isRecursive":true,"isAuditEnabled":true,"version":"1","replacePerm":false}'
On Sun, Aug 9, 2015 at 2:29 PM, Hafiz Mujadid <ha...@gmail.com>> wrote:
Hi Experts!
I tried this command to create a new policy
curl -i --header "Accept:application/json" -H "Content-Type:application/json" --user admin:admin -X POST http://122.129.79.69:6080/service/public/api/policy -d '{ "policyName":"hdt",resourceName:"/test","description":"curl","repositoryName":"hdfs-repo","repositoryType":"hdfs","permMapList":[{"userList":["mujadid"],"permList":["Read"]},{"groupList":["internal"],"permList":["Read"]}],"isEnabled":true,isRecursive:true,"isAuditEnabled":true,"version":"1","replacePerm":false}'
But it is giving following response
HTTP/1.1 404 Not Found
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=66399D5EE5D1859A293C467C0D300F87; Path=/; HttpOnly
Content-Length: 0
Date: Sun, 09 Aug 2015 09:11:49 GMT
--
Regards: HAFIZ MUJADID
Re: rest api create policy giving 404 error
Posted by Hafiz Mujadid <ha...@gmail.com>.
Hi sorry i was mistaking in json
here is my correct command
curl -i --header "Accept:application/json" -H
"Content-Type:application/json" --user admin:admin -X POST
http://122.129.79.69:6080/service/public/api/policy -d '{
"policyName":"hdt","resourceName":"/test","description":"curl","repositoryName":"hdfs-repo","repositoryType":"hdfs","permMapList":[{"userList":["mujadid"],"permList":["Read"]},{"groupList":["internal"],"permList":["Read"]}],"isEnabled":true,"isRecursive":true,"isAuditEnabled":true,"version":"1","replacePerm":false}'
On Sun, Aug 9, 2015 at 2:29 PM, Hafiz Mujadid <ha...@gmail.com>
wrote:
> Hi Experts!
>
> I tried this command to create a new policy
> curl -i --header "Accept:application/json" -H
> "Content-Type:application/json" --user admin:admin -X POST
> http://122.129.79.69:6080/service/public/api/policy -d '{
> "policyName":"hdt",resourceName:"/test","description":"curl","repositoryName":"hdfs-repo","repositoryType":"hdfs","permMapList":[{"userList":["mujadid"],"permList":["Read"]},{"groupList":["internal"],"permList":["Read"]}],"isEnabled":true,isRecursive:true,"isAuditEnabled":true,"version":"1","replacePerm":false}'
>
>
> But it is giving following response
>
> HTTP/1.1 404 Not Found
> Server: Apache-Coyote/1.1
> Set-Cookie: JSESSIONID=66399D5EE5D1859A293C467C0D300F87; Path=/; HttpOnly
> Content-Length: 0
> Date: Sun, 09 Aug 2015 09:11:49 GMT
>
>
>
>
--
Regards: HAFIZ MUJADID