updating a repo-group with the REST API failing with 400

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

updating a repo-group with the REST API failing with 400

stevemaring
This post was updated on .
I am able to create a new repo just fine with the REST API on 2.8.0-05 ...

buildguy@release:~/test$ curl -i -H "Accept: application/xml" -H
"Content-Type: application/xml" -f -X POST -v -d "@$(pwd)/repo.xml" -u
buildguy:xxxxxxxx http://10.100.8.122:8081/service/local/repositories
* About to connect() to 10.100.8.122 port 8081 (#0)
*   Trying 10.100.8.122... connected
* Connected to 10.100.8.122 (10.100.8.122) port 8081 (#0)
* Server auth using Basic with user 'buildguy'
> POST /service/local/repositories HTTP/1.1
> Authorization: Basic xxxxxxxxxxxx
> User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7
OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
> Host: 10.100.8.122:8081
> Accept: application/xml
> Content-Type: application/xml
> Content-Length: 795
>
< HTTP/1.1 201 Created
HTTP/1.1 201 Created
< Date: Wed, 28 May 2014 14:02:45 GMT
Date: Wed, 28 May 2014 14:02:45 GMT
< Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Tue,
27-May-2014 14:02:45 GMT
Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Tue,
27-May-2014 14:02:45 GMT
< Content-Type: application/xml; charset=UTF-8
Content-Type: application/xml; charset=UTF-8
< Date: Wed, 28 May 2014 14:02:46 GMT
Date: Wed, 28 May 2014 14:02:46 GMT
< Server: Noelios-Restlet-Engine/1.1.6-SONATYPE-5348-V8
Server: Noelios-Restlet-Engine/1.1.6-SONATYPE-5348-V8
< Content-Length: 757
Content-Length: 757

<
<repository>
  <data>
    <contentResourceURI>
http://10.100.8.122:8081/content/repositories/test-repo</contentResourceURI>
    <id>test-repo</id>
    <name>test-repo</name>
    <provider>maven2</provider>

<providerRole>org.sonatype.nexus.proxy.repository.Repository</providerRole>
    <format>maven2</format>
    <repoType>hosted</repoType>
    <exposed>true</exposed>
    <writePolicy>ALLOW_WRITE_ONCE</writePolicy>
    <browseable>true</browseable>
    <indexable>true</indexable>
    <notFoundCacheTTL>1440</notFoundCacheTTL>
    <repoPolicy>RELEASE</repoPolicy>
    <downloadRemoteIndexes>false</downloadRemoteIndexes>

<defaultLocalStorageUrl>file:/usr/local/sonatype-work/nexus/storage/test-repo</defaultLocalStorageUrl>
  </data>
* Connection #0 to host 10.100.8.122 left intact
* Closing connection #0
</repository>


If I then go and try to create that same repo again, I get ...

buildguy@release:~/test$ curl -i -H "Accept: application/xml" -H
"Content-Type: application/xml" -f -X POST -v -d "@$(pwd)/repo.xml" -u
buildguy:xxxxxxx  http://10.100.8.122:8081/service/local/repositories
* About to connect() to 10.100.8.122 port 8081 (#0)
*   Trying 10.100.8.122... connected
* Connected to 10.100.8.122 (10.100.8.122) port 8081 (#0)
* Server auth using Basic with user 'buildguy'
> POST /service/local/repositories HTTP/1.1
> Authorization: Basic xxxxxxxxxxx
> User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7
OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
> Host: 10.100.8.122:8081
> Accept: application/xml
> Content-Type: application/xml
> Content-Length: 795
>
* The requested URL returned error: 400
* Closing connection #0
curl: (22) The requested URL returned error: 400


it isn't a pretty response ... I'd sorta expect something a bit more
friendly in terms of "Hey you moron, that repo already exists!" ... but OK

Now, when I try to update a repo group though, I get the same 400 ...


buildguy@release:~/test$ curl -i -H "Accept: application/xml" -H
"Content-Type: application/xml" -f -X POST -v -d
"groupId=private-release-repos" -d "@$(pwd)/input.xml" -u
buildguy:xxxxxxxxxx http://10.100.8.122:8081/service/local/repo_groups
* About to connect() to 10.100.8.122 port 8081 (#0)
*   Trying 10.100.8.122... connected
* Connected to 10.100.8.122 (10.100.8.122) port 8081 (#0)
* Server auth using Basic with user 'buildguy'
> POST /service/local/repo_groups HTTP/1.1
> Authorization: Basic xxxxxxx
> User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7
OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
> Host: 10.100.8.122:8081
> Accept: application/xml
> Content-Type: application/xml
> Content-Length: 2448
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
HTTP/1.1 100 Continue

* The requested URL returned error: 400
* Closing connection #0
curl: (22) The requested URL returned error: 400



Any thoughts what might be going on here?

The user I am authenticating with is in the Nexus administrator role

-Steve
Orlando, FL
Reply | Threaded
Open this post in threaded view
|

Re: updating a repo-group with the REST API failing with 400

stevemaring
This post was updated on .
I've tried this same thing in Java, with Commons HttpClient ala ...

Post Method post = new PostMethod( "http://10.100.8.122:8081/service/local/repo_groups/private-release-repos" );
post.setParameter("groupId", "private-release-repos");
post.setRequestBody( updatedRepoGroup );
post.setRequestHeader( "Content-type", "application/xml; charset=UTF-8" );
post.setRequestHeader( "Accept", "application/xml" );
post.setDoAuthentication( true );
HttpClient httpclient = new HttpClient();
httpclient.getState().setCredentials( new AuthScope( "10.100.8.122", 8081 ), new UsernamePasswordCredentials( NEXUS_USER, NEXUS_PASSWORD ) );
int result = httpclient.executeMethod(post);
println("Response status code: " + result);
println("Response body: ");
println(post.getResponseBodyAsString());
post.releaseConnection();

which outputs ...

Response status code: 405
Response body:
<html>
  <head>
    <title>405 - Method Not Allowed</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

           
    <link rel="icon" type="image/png" href="http://10.100.8.122:8081/favicon.png">
   

    <link rel="stylesheet" href="http://10.100.8.122:8081/static/css/Sonatype-content.css?2.8.0-05" type="text/css" media="screen" title="no title" charset="utf-8">
  </head>
  <body>
   

405 - Method Not Allowed

    <p>The method specified in the request is not allowed for the resource identified by the request URI</p>
  </body>
</html>

and the nexus.log says ...

2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.web.filter.PathMatchingFilter - Filter 'perms' is enabled for the current request under path '/service/local/repo_groups/*' with conf
ig [[nexus:repogroups]].  Delegating to subclass implementation for 'onPreHandle' check.
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.web.filter.authz.HttpMethodPermissionFilter - MAPPED 'create' action to permission(s) 'nexus:repogroups:create'
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.util.ThreadContext - get() - in thread [qtp1257130887-84]
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.util.ThreadContext - Retrieved value of type [org.apache.shiro.web.subject.support.WebDelegatingSubject] for key [org.apache.shiro.ut
il.ThreadContext_SUBJECT_KEY] bound to thread [qtp1257130887-84]
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.subject.support.DelegatingSubject - attempting to get session; create = false; session is null = true; session has id = false
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.subject.support.DelegatingSubject - attempting to get session; create = false; session is null = true; session has id = false
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.realm.AuthorizingRealm - Retrieving AuthorizationInfo for principals [buildguy]
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.realm.AuthorizingRealm - Attempting to retrieve the AuthorizationInfo from cache.
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.cache.ehcache.EhCache - Getting object from cache [XmlAuthenticatingRealm.authorizationCache] for key [buildguy]
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.cache.ehcache.EhCache - Element for [buildguy] is null.
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.realm.AuthorizingRealm - No AuthorizationInfo found in cache for principals [buildguy]
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.sonatype.security.authorization.ExceptionCatchingModularRealmAuthorizer - Realm: XmlAuthenticatingRealm user: buildguy does NOT have permission: n
exus:repogroups:create
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.realm.AuthorizingRealm - Retrieving AuthorizationInfo for principals [buildguy]
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.realm.AuthorizingRealm - Attempting to retrieve the AuthorizationInfo from cache.
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.cache.ehcache.EhCache - Getting object from cache [XmlAuthorizingRealm.authorizationCache] for key [buildguy]
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.realm.AuthorizingRealm - AuthorizationInfo found in cache for principals [buildguy]
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.sonatype.security.authorization.ExceptionCatchingModularRealmAuthorizer - Realm: XmlAuthorizingRealm user: buildguy has permission: nexus:repogrou
ps:create
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.web.servlet.AdviceFilter - Invoked preHandle method.  Continuing chain?: [true]
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.web.servlet.ProxiedFilterChain - Invoking original filter chain.
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.util.ThreadContext - get() - in thread [qtp1257130887-84]
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.util.ThreadContext - Retrieved value of type [org.apache.shiro.web.subject.support.WebDelegatingSubject] for key [org.apache.shiro.ut
il.ThreadContext_SUBJECT_KEY] bound to thread [qtp1257130887-84]
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.subject.support.DelegatingSubject - attempting to get session; create = false; session is null = true; session has id = false
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.subject.support.DelegatingSubject - attempting to get session; create = false; session is null = true; session has id = false
2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.web.servlet.OncePerRequestFilter - Filter 'Key[type=org.sonatype.nexus.web.internal.SecurityFilter, annotation=[none]]' already executed.  Proceeding without invoking this filter.
2014-05-28 11:08:33 DEBUG [qtp1257130887-84] buildguy org.sonatype.nexus.restlet1x.internal.RestletServlet - Processing: POST /service/local/repo_groups/private-release-repos (http://10.100.8.122:8081/service/local/repo_groups/private-release-repos)
2014-05-28 11:08:33 DEBUG [qtp1257130887-84] buildguy com.sonatype.nexus.analytics.internal.EventRecorderImpl - Record: EventData{type='REST', timestamp=93235400757023, userId='buildguy', sessionId='null', attributes={ui=false, duration=5991103, status=405, path=/service/local/repo_groups/private-release-repos, method=POST}}
Reply | Threaded
Open this post in threaded view
|

Re: updating a repo-group with the REST API failing with 400

Peter Lynch-2
Can you try using PUT instead of POST?

-Peter


On Wed, May 28, 2014 at 12:20 PM, stevemaring <[hidden email]> wrote:
I've tried this same thing in Java, with Commons HttpClient ala ... Post Method post = new PostMethod( "http://10.100.8.122:8081/service/local/repo_groups/private-release-repos" ); post.setParameter("groupId", "private-release-repos"); post.setRequestBody( updatedRepoGroup ); post.setRequestHeader( "Content-type", "application/xml; charset=UTF-8" ); post.setRequestHeader( "Accept", "application/xml" ); post.setDoAuthentication( true ); HttpClient httpclient = new HttpClient(); httpclient.getState().setCredentials( new AuthScope( "10.100.8.122", 8081 ), new UsernamePasswordCredentials( NEXUS_USER, NEXUS_PASSWORD ) ); int result = httpclient.executeMethod(post); println("Response status code: " + result); println("Response body: "); println(post.getResponseBodyAsString()); post.releaseConnection(); which outputs ... Response status code: 405 Response body: <html> <head> <link rel="icon" type="image/png" href="http://10.100.8.122:8081/favicon.png"> <link rel="stylesheet" href="http://10.100.8.122:8081/static/css/Sonatype-content.css?2.8.0-05" type="text/css" media="screen" title="no title" charset="utf-8"> </head> <body>

405 - Method Not Allowed

The method specified in the request is not allowed for the resource identified by the request URI

</body> </html> and the nexus.log says ... 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.web.filter.PathMatchingFilter - Filter 'perms' is enabled for the current request under path '/service/local/repo_groups/*' with conf ig [[nexus:repogroups]]. Delegating to subclass implementation for 'onPreHandle' check. 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.web.filter.authz.HttpMethodPermissionFilter - MAPPED 'create' action to permission(s) 'nexus:repogroups:create' 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.util.ThreadContext - get() - in thread [qtp1257130887-84] 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.util.ThreadContext - Retrieved value of type [org.apache.shiro.web.subject.support.WebDelegatingSubject] for key [org.apache.shiro.ut il.ThreadContext_SUBJECT_KEY] bound to thread [qtp1257130887-84] 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.subject.support.DelegatingSubject - attempting to get session; create = false; session is null = true; session has id = false 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.subject.support.DelegatingSubject - attempting to get session; create = false; session is null = true; session has id = false 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.realm.AuthorizingRealm - Retrieving AuthorizationInfo for principals [buildguy] 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.realm.AuthorizingRealm - Attempting to retrieve the AuthorizationInfo from cache. 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.cache.ehcache.EhCache - Getting object from cache [XmlAuthenticatingRealm.authorizationCache] for key [buildguy] 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.cache.ehcache.EhCache - Element for [buildguy] is null. 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.realm.AuthorizingRealm - No AuthorizationInfo found in cache for principals [buildguy] 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.sonatype.security.authorization.ExceptionCatchingModularRealmAuthorizer - Realm: XmlAuthenticatingRealm user: buildguy does NOT have permission: n exus:repogroups:create 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.realm.AuthorizingRealm - Retrieving AuthorizationInfo for principals [buildguy] 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.realm.AuthorizingRealm - Attempting to retrieve the AuthorizationInfo from cache. 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.cache.ehcache.EhCache - Getting object from cache [XmlAuthorizingRealm.authorizationCache] for key [buildguy] 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.realm.AuthorizingRealm - AuthorizationInfo found in cache for principals [buildguy] 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.sonatype.security.authorization.ExceptionCatchingModularRealmAuthorizer - Realm: XmlAuthorizingRealm user: buildguy has permission: nexus:repogrou ps:create 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.web.servlet.AdviceFilter - Invoked preHandle method. Continuing chain?: [true] 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.web.servlet.ProxiedFilterChain - Invoking original filter chain. 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.util.ThreadContext - get() - in thread [qtp1257130887-84] 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.util.ThreadContext - Retrieved value of type [org.apache.shiro.web.subject.support.WebDelegatingSubject] for key [org.apache.shiro.ut il.ThreadContext_SUBJECT_KEY] bound to thread [qtp1257130887-84] 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.subject.support.DelegatingSubject - attempting to get session; create = false; session is null = true; session has id = false 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.subject.support.DelegatingSubject - attempting to get session; create = false; session is null = true; session has id = false 2014-05-28 11:08:33 TRACE [qtp1257130887-84] buildguy org.apache.shiro.web.servlet.OncePerRequestFilter - Filter 'Key[type=org.sonatype.nexus.web.internal.SecurityFilter, annotation=[none]]' already executed. Proceeding without invoking this filter. 2014-05-28 11:08:33 DEBUG [qtp1257130887-84] buildguy org.sonatype.nexus.restlet1x.internal.RestletServlet - Processing: POST /service/local/repo_groups/private-release-repos (http://10.100.8.122:8081/service/local/repo_groups/private-release-repos) 2014-05-28 11:08:33 DEBUG [qtp1257130887-84] buildguy com.sonatype.nexus.analytics.internal.EventRecorderImpl - Record: EventData{type='REST', timestamp=93235400757023, userId='buildguy', sessionId='null', attributes={ui=false, duration=5991103, status=405, path=/service/local/repo_groups/private-release-repos, method=POST}}

View this message in context: Re: updating a repo-group with the REST API failing with 400
Sent from the Nexus Maven Repository Manager Users List mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: updating a repo-group with the REST API failing with 400

stevemaring
This post was updated on .
oops ... my bad ... I didn't notice the API said PUT for that and not POST

so I did ...

PutMethod put = new PutMethod ( "http://10.100.8.122:8081/service/local/repo_groups/private-release-repos" );
HttpMethodParams httpMethodParams = new HttpMethodParams();
httpMethodParams.setParameter("groupId", "private-release-repos");
put.setParams(httpMethodParams);
put.setRequestBody( updatedRepoGroup );
put.setRequestHeader( "Content-type", "application/xml; charset=UTF-8" );
put.setRequestHeader( "Accept", "application/xml" );
put.setDoAuthentication( true );
httpclient = new HttpClient();
httpclient.getState().setCredentials( new AuthScope( "10.100.8.122", 8081 ), new UsernamePasswordCredentials( params.NEXUS_USER, params.NEXUS_PASSWORD ) );
result = httpclient.executeMethod(put);
println("Response status code: " + result);
println("Response body: ");
println(put.getResponseBodyAsString());
put.releaseConnection();

and it worked ... thanks
Reply | Threaded
Open this post in threaded view
|

Re: updating a repo-group with the REST API failing with 400

Peter Lynch-2



On Wed, May 28, 2014 at 2:04 PM, stevemaring <[hidden email]> wrote:
oops ... my bad ... I didn't notice the API said PUT for that and not POST

so I did ...

PutMethod put = new PutMethod (
"http://10.100.8.122:8081/service/local/repo_groups/private-release-repos"
);
HttpMethodParams httpMethodParams = new HttpMethodParams();
httpMethodParams.setParameter("groupId", "private-release-repos");
put.setParams(httpMethodParams);
put.setRequestBody( updatedRepoGroup );
put.setRequestHeader( "Content-type", "application/xml; charset=UTF-8" );
put.setRequestHeader( "Accept", "application/xml" );
put.setDoAuthentication( true );
httpclient = new HttpClient();
httpclient.getState().setCredentials( new AuthScope( "10.100.8.122", 8081 ),
new UsernamePasswordCredentials( params.NEXUS_USER, params.NEXUS_PASSWORD )
);
result = httpclient.executeMethod(post);
println("Response status code: " + result);
println("Response body: ");
println(post.getResponseBodyAsString());
put.releaseConnection();


The above creates a 'put' method, yet still does result = httpclient.executeMethod(post);
So I am not sure what you actually sent.
 

and got back

Response status code: 400
Response body:
<nexus-error>
  <errors>
    <error>
      <id>id</id>
      <msg>Repository with ID=test-repo already exists!</msg>
    </error>
  </errors>
</nexus-error>


I had already created that repo, but that's not what I was asking.

I had added it to the group XML like so ...

<repo-group>
  <data>

<contentResourceURI>http://10.100.8.122:8081/content/groups/private-release-repos</contentResourceURI>
    <id>private-release-repos</id>
    <name>private-release-repos</name>
    <provider>maven2</provider>
    <format>maven2</format>
    <repoType>group</repoType>
    <exposed>true</exposed>
    <repositories>
      **** all the existing members of the group *****
      <repo-group-member>
        <id>test-repo</id>
        <name>test-repo</name>

<resourceURI>http://10.100.8.122:8081/service/local/repo_groups/private-release-repos/test-rpo</resourceURI>
      </repo-group-member>
    </repositories>
  </data>
</repo-group>



Is there a new error you can show from doing a put?
 
-Peter


--
View this message in context: http://maven.40175.n5.nabble.com/updating-a-repo-group-with-the-REST-API-failing-with-400-tp5794279p5794299.html
Sent from the Nexus Maven Repository Manager Users List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: updating a repo-group with the REST API failing with 400

stevemaring
I edited that post directly on Nabble shortly after posting it.   I swapped out those posts(s) I missed for the put and it worked fine.

Thanks.


On Wed, May 28, 2014 at 2:58 PM, Peter Lynch-2 [via Maven] <[hidden email]> wrote:



On Wed, May 28, 2014 at 2:04 PM, stevemaring <[hidden email]> wrote:
oops ... my bad ... I didn't notice the API said PUT for that and not POST

so I did ...

PutMethod put = new PutMethod (
"http://10.100.8.122:8081/service/local/repo_groups/private-release-repos"
);
HttpMethodParams httpMethodParams = new HttpMethodParams();
httpMethodParams.setParameter("groupId", "private-release-repos");
put.setParams(httpMethodParams);
put.setRequestBody( updatedRepoGroup );
put.setRequestHeader( "Content-type", "application/xml; charset=UTF-8" );
put.setRequestHeader( "Accept", "application/xml" );
put.setDoAuthentication( true );
httpclient = new HttpClient();
httpclient.getState().setCredentials( new AuthScope( "10.100.8.122", 8081 ),
new UsernamePasswordCredentials( params.NEXUS_USER, params.NEXUS_PASSWORD )
);
result = httpclient.executeMethod(post);
println("Response status code: " + result);
println("Response body: ");
println(post.getResponseBodyAsString());
put.releaseConnection();


The above creates a 'put' method, yet still does result = httpclient.executeMethod(post);
So I am not sure what you actually sent.
 

and got back

Response status code: 400
Response body:
<nexus-error>
  <errors>
    <error>
      <id>id</id>
      <msg>Repository with ID=test-repo already exists!</msg>
    </error>
  </errors>
</nexus-error>


I had already created that repo, but that's not what I was asking.

I had added it to the group XML like so ...

<repo-group>
  <data>

<contentResourceURI>http://10.100.8.122:8081/content/groups/private-release-repos</contentResourceURI>
    <id>private-release-repos</id>
    <name>private-release-repos</name>
    <provider>maven2</provider>
    <format>maven2</format>
    <repoType>group</repoType>
    <exposed>true</exposed>
    <repositories>
      **** all the existing members of the group *****
      <repo-group-member>
        <id>test-repo</id>
        <name>test-repo</name>

<resourceURI>http://10.100.8.122:8081/service/local/repo_groups/private-release-repos/test-rpo</resourceURI>
      </repo-group-member>
    </repositories>
  </data>
</repo-group>



Is there a new error you can show from doing a put?
 
-Peter


--
View this message in context: http://maven.40175.n5.nabble.com/updating-a-repo-group-with-the-REST-API-failing-with-400-tp5794279p5794299.html

Sent from the Nexus Maven Repository Manager Users List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]





If you reply to this email, your message will be added to the discussion below:
http://maven.40175.n5.nabble.com/updating-a-repo-group-with-the-REST-API-failing-with-400-tp5794279p5794310.html
To unsubscribe from updating a repo-group with the REST API failing with 400, click here.
NAML