api POST returning error 500

I have just set up a basic XF2 installation prior to upgrading from 1.5
Included are a user and a thread.
An API GET works but the similar POST fails with an error 500 and I have been unable to trace the problem.

for example a GET users/2/ will return the user details whereas just changing the GET to POST causes the failure instead of doing an update
The POST example includes a body parameter username=xxxxxxx and both examples are based on a super key for all scopes.

Any advice would be appreciated.
 
Since posting the original message I have been trying all the options that I can think of without any success.
This includes adding write permissions to almost everything to all the update to XF2.2.
Have I missed something obvious?

I am running on a shared server and the response that I am getting is
HttpError, Err Number = : 5::0System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
at System.Net.HttpWebRequest.GetResponse()
at forum_xentest.Page_Load(Object sender, EventArgs e) in C:\Users\Nigel\Documents\My Web Sites\gognet\forum\xentest.aspx.vb:line 31:

The test program that I am using is:
Partial Class forum_xentest
Inherits System.Web.UI.Page

Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim apistring As String = ""

Dim xenheaders As New System.Net.WebHeaderCollection
xenheaders.Add("XF-Api-Key", "XcRGYtvJiDbQQ6FO5vgAgjqH_AJwlzZi")

Dim apifulluri As New Uri("https://www.gauge0guildarchive.com/proofxenforo/index.php/api/users/2/")
Dim apirequest As Net.HttpWebRequest = Net.WebRequest.Create(apifulluri)

apirequest.Method = "POST"
apirequest.Headers = xenheaders

If apirequest.Method = "POST" Then
apirequest.SendChunked = True

Dim byte1 As Byte() = Text.Encoding.UTF8.GetBytes("username=Melson1234&password=melson&email=melson@nsquared.net")
' Set the content type of the data being posted.
apirequest.ContentType = "application/x-www-form-urlencoded"
' Set the content length of the string being posted.
apirequest.ContentLength = byte1.Length
Dim newStream As IO.Stream = apirequest.GetRequestStream()
newStream.Write(byte1, 0, byte1.Length)
newStream.Close()
End If
Try
Dim apiresponse As Net.HttpWebResponse = apirequest.GetResponse()
Dim apistream As IO.Stream = apiresponse.GetResponseStream()
Dim encode As Encoding = System.Text.Encoding.GetEncoding("utf-8")
Dim readStream As New IO.StreamReader(apistream, encode)
Dim read(256) As [Char]
Dim count As Integer = readStream.Read(read, 0, 256)
While count > 0
' Dumps the 256 characters to a string
Dim str As New [String](read, 0, count)
apistring += str
count = readStream.Read(read, 0, 256)
End While
apistream.Close()
apiresponse.Close()
TextBox1.Text = apistring
Catch
TextBox1.Text = "HttpError, Err Number = : " & Err().Number.ToString & "::" & Err.Erl.ToString & Err.GetException.ToString & ":<br />" & Now()
End Try
End Sub
End Class
 
Removing the 'SendChunked' gave a distinct improvement in that the results became either a 403 forbidden or 404 path not found.
It soon became apparent that the usual cause of these errors was the data either being out of range or wrongly formatted.
Result is that GET api/threads?page=1 and POST api/threads/ are working.
However I am still struggling with GET api/users?page=1 and POST api/users/ both coming up with a 403 forbidden.

The GET api/users documentation looks identical to the GET api/threads documentation so i am still looking for what I have missed.
 
Top Bottom