Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

REST API POST ISSUES #226

Closed
mirceapopro opened this issue Jun 23, 2017 · 2 comments
Closed

REST API POST ISSUES #226

mirceapopro opened this issue Jun 23, 2017 · 2 comments

Comments

@mirceapopro
Copy link

Hi,

I'm trying to configure the plugin for a specific repository through the REST API but the POST returns a HTTP 405. GET works fine

  • Plugin version used - 4.62
  • Bitbucket Server version used - 4.12.1
  • user has admin rights at the repository level
    post.wpiadmin.zip

GET

$ curl -k -v -u 'user:user' -H 'Content-Type: application/json; charset=UTF-8' 'http://localhost:7990/bitbucket/rest/prnfb-admin/1.0/settings/notifications/projectKey/TEST/repositorySlug/wpiadmin'
* timeout on name lookup is not supported
*   Trying 127.0.0.1...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to localhost (127.0.0.1) port 7990 (#0)
* Server auth using Basic with user 'user'
> GET /bitbucket/rest/prnfb-admin/1.0/settings/notifications/projectKey/TEST/repositorySlug/wpiadmin HTTP/1.1
> Host: localhost:7990
> Authorization: Basic dXNlcjp1c2Vy
> User-Agent: curl/7.44.0
> Accept: */*
> Content-Type: application/json; charset=UTF-8
>
< HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
< X-AREQUESTID: @1CK6TTDx608x249x0
< X-AUSERID: 2
< X-AUSERNAME: user
< X-Content-Type-Options: nosniff
< Content-Type: application/json
< Transfer-Encoding: chunked
< Date: Fri, 23 Jun 2017 08:08:03 GMT
<
{ [3 bytes data]
100     2    0     2    0     0     31      0 --:--:-- --:--:-- --:--:--    42[]
* Connection #0 to host localhost left intact

POST

$ curl -k -v -u 'user:user' -H 'Content-Type: application/json; charset=UTF-8' -d @post.wpiadmin.json 'http://localhost:7990/bitbucket/rest/prnfb-admin/1.0/settings/notifications/projectKey/TEST/repositorySlug/wpiadmin'                                                    * timeout on name lookup is not supported
*   Trying 127.0.0.1...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to localhost (127.0.0.1) port 7990 (#0)
* Server auth using Basic with user 'user'
> POST /bitbucket/rest/prnfb-admin/1.0/settings/notifications/projectKey/TEST/repositorySlug/wpiadmin HTTP/1.1
> Host: localhost:7990
> Authorization: Basic dXNlcjp1c2Vy
> User-Agent: curl/7.44.0
> Accept: */*
> Content-Type: application/json; charset=UTF-8
> Content-Length: 819
>
} [819 bytes data]
* upload completely sent off: 819 out of 819 bytes
< HTTP/1.1 405 Method Not Allowed
< Server: Apache-Coyote/1.1
< X-AREQUESTID: @1CK6TTDx607x248x0
< X-AUSERID: 2
< X-AUSERNAME: user
< Allow: HEAD,GET,OPTIONS
< X-Content-Type-Options: nosniff
< Content-Type: text/html;charset=utf-8
< Content-Language: en
< Content-Length: 1056
< Date: Fri, 23 Jun 2017 08:07:46 GMT
<
{ [1056 bytes data]
100  1875  100  1056  100   819  13538  10500 --:--:-- --:--:-- --:--:-- 13538<!DOCTYPE html><html><head><title>Apache Tomcat/8.0.36 - Error report</title><style type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: none;}</style> </head><body><h1>HTTP Status 405 - Method Not Allowed</h1><div class="line"></div><p><b>type</b> Status report</p><p><b>message</b> <u>Method Not Allowed</u></p><p><b>description</b> <u>The specified HTTP method is not allowed for the requested resource.</u></p><hr class="line"><h3>Apache Tomcat/8.0.36</h3></body></html>
* Connection #0 to host localhost left intact
@tomasbjerre
Copy link
Owner

You should post to /bitbucket/rest/prnfb-admin/1.0/settings/notifications and not supply project and repo there in the path. I updated the readme now, the markdown was not correct.

@mirceapopro
Copy link
Author

mirceapopro commented Jun 23, 2017 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants