• REST API Problem ... document/rename

  • We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #30831  by stepgilb
 
Dear Community,

I am trying to get the following REST API call to work using the documentation (http://localhost:8080/OpenKM/services/r ... ment?_wadl) but am only getting a "415 Unsupported Media Type error", has anyone encountered the same problem or has a fix? Any help is highly appreciated!
Code: Select all
curl -v -u okmAdmin:admin -X PUT "Content-Type: application/x-www-form-urlencoded" -H "Accept: application/json" \
 -d newName=blabla -d docId=9f9be747-9302-4f50-9d7e-a37633ddb8f2 http://localhost:8080/OpenKM/services/rest/document/rename
Result:
* getaddrinfo(3) failed for Content-Type: application:80
* Couldn't resolve host 'Content-Type: application'
* Closing connection #0
curl: (6) Couldn't resolve host 'Content-Type: application'
* About to connect() to localhost port 8080
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8080
* Server auth using Basic with user 'okmAdmin'
> PUT /OpenKM/services/rest/document/rename HTTP/1.1
> Authorization: Basic b2ttQWRtaW46YWRtaW4=
> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: localhost:8080
> Accept: application/json
> Content-Length: 57
> Content-Type: application/x-www-form-urlencoded
>
> newName=blabla&docId=9f9be747-9302-4f50-9d7e-a37633ddb8f2HTTP/1.1 415 Unsupported Media Type
< Server: Apache-Coyote/1.1
< Date: Tue, 06 Jan 2015 00:56:52 GMT
< Content-Length: 0
* Connection #0 to host localhost left intact
* Closing connection #0
 #30842  by jllort
 
Here is the class what implements the webservice https://sourceforge.net/p/openkm/code/H ... rvice.java
Code: Select all
@PUT
	@Path("/rename")
	public Document rename(@QueryParam("docId") String docId, @QueryParam("newName") String newName) throws GenericException {
That means rename in this case should be simple url with query params http://localhost:8080/OpenKM/services/r ... mename.doc ( all parameters must be url encoded ).

"Content-Type: application/x-www-form-urlencoded" is not applicable to this call only comsumes xml or json, nothing else.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.