http://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-CreateorReplaceRepositoryConfiguration
I use the Create or Replace Repository Configuration call. However, I get error 406: invalid. Other PUT calls work, but do not return JSON. I believe that JSON is the source of the error, but could not resolve or prove it.
I added the code below
RestClient Client = new RestClient(uriString); RestRequest Request = new RestRequest(requestType); Request.AddHeader("Authorization", "Basic " + credentials); Request.AddHeader("Accept", "application/json");
I saw streams where adding a header to accept JSON resolves the error, but this did not work for me.
A 406 HTTP status , - , , , , , 406. , -, accept., application/json:
application/json
Request.AddHeader("Accept", "application/json");
REST API, , text/plain., /plain:
text/plain
Request.AddHeader("Accept", "text/plain");
, . , Postman , Content-Type "application/hal + json". /json .
, , , .
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/hal+json"));
Firstly, the header Acceptindicates that the client is ready to return, and not what the client is sending. Header, which indicates that the sending client Content-Type.
Accept
Content-Type
In addition, this method does not accept application/json. As clearly indicated in the documents, it takes one of the following meanings:
application/vnd.org.jfrog.artifactory.repositories.LocalRepositoryConfiguration+json
application/vnd.org.jfrog.artifactory.repositories.RemoteRepositoryConfiguration+json
application/vnd.org.jfrog.artifactory.repositories.VirtualRepositoryConfiguration+json