← Back to team overview

dhis2-users team mailing list archive

Re: creating objects with web api, POST fails

 

Hi Lavi,

the problem is the DHIS version - we implemented support for CRUD
operations at the various end-points in version 2.15. Could you please
update to 2.15 and try again?

dhis2.org/downloads

regards,

Lars


PS. we need to version our docs but haven't gotten around to do it yet.






On Sun, Jun 29, 2014 at 1:08 PM, Lavi Shpigelman <shpigi@xxxxxxxxx> wrote:

> Hi
> I have a server (on Linux, running on Tomcat) with and empty dhis app
> running (version 2.14)
>
> I would like to populate it with data (and metadata) using the web API.
> I tried an example from the documentation:
>
> I created a file called  pi.xml:
>
> <constant name="PI" xmlns="http://dhis2.org/schema/dxf/2.0";>
>   <value>3.14159265359</value>
> </constant>
>
> and gave this command from my windows command line:
>
> C:\>curl.exe -d @pi.xml "http://<my host name>:8080/dhis/api/constants" -H "Content-Type:application/xml" -u admin:district -v
>
> The server responded with
>
> <html><head><title>Apache Tomcat/7.0.52 (Debian) - Error report</title><style><!--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;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 405 - Request method 'POST' not supported</h1><HR size="1" noshade="noshade"><p><b>type</b>Status report</p><p><b>message</b> <u>Request method 'POST' not supported</u></p><p><b>description</b> <u>The specified HTTP method is not allowed for the requested resource.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.52 (Debian)</h3></body></html>
>
> when I tried the same with https (instead of http), I got the reply:
>
> C:\>curl.exe -d @pi.xml "https://<my host name>:8080/dhis/api/constants" -
> H "Content-Type:application/xml" -u admin:district -v
> * Hostname was NOT found in DNS cache
> *   Trying <my host ip address>...
> * Connected to <my host name> (<my host ip adress>) port 8080 (#0)
> * schannel: SSL/TLS connection with <my host name> port 8080 (step 1/3)
> * schannel: checking server certificate revocation
> * schannel: sending initial handshake data: sending 171 bytes...
> * schannel: sent initial handshake data: sent 171 bytes
> * schannel: SSL/TLS connection with <my host name> port 8080 (step 2/3)
> * schannel: failed to receive handshake, need more data
> * schannel: SSL/TLS connection with <my host name> port 8080 (step 2/3)
> * schannel: encrypted data buffer: offset 144 length 4096
> * schannel: next InitializeSecurityContext failed: SEC_E_INVALID_TOKEN (0x80090308) - The token supplied to the function is invalid
> * Closing connection 0
> * schannel: shutting down SSL/TLS connection with <my host name> port 8080
> * schannel: clear security context handle
> * schannel: clear credential handle
> curl: (35) schannel: next InitializeSecurityContext failed: SEC_E_INVALID_TOKEN (0x80090308) - The token supplied to the function is invalid
>
> The same command (using https with my windows curl) was successful when sent to the dhis web site demo app
>
> I am guessing that creating objects in dhis requires a secure connection and that my server does not currently support it.  (or does not support the specific ssh protocol that curl uses?)
>
> Is this the problem or am I missing something?
>
>
> Thanks,
>
> Lavi
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References