-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help debugging API call #592
Comments
Maybe try removing the trailing comma at the end? |
Thanks Jeff, no, I have tried it both with and without the comma. |
I just realized that I trigger a error that shows up in nextcloud's logging each time I send the above -
sounds like usefull information...... |
You can safely ignore the session error message. It's a bug in Nextcloud server (see nextcloud/server#20490) and was fixed in nextcloud/server#22243 (will be part of 19.0.2). Please provide some code if you want us to help. I'm wondering about the URL-encoded JSON in the DumpIO output. That may be the problem. Please also try to use
|
Hmm, thanks korelstar, not sure you will want to see my code, its in Free Pascal. Below. And my content is marked, in the logs as But interesting, your curl line (with my URL) does not work either. But it does at least set the content type to I have quite a different URL to you but as I can get the GET to work, don't think thats the issue here. The code ? really ? OK. Client := TFPHttpClient.Create(nil);
Client.AddHeader('User-Agent','Mozilla/5.0 (compatible; fpweb)');
Client.AddHeader('Content-type','application/json');
Client.AllowRedirect := true;
Client.UserName:=USER;
Client.Password:=PW;
Response := TStringStream.Create('');
try
try
Client.FormPost(TheURL, Params, Response);
DumpResponse(Response.DataString);
except on E:Exception do begin
Result := 0;
writeln(' bad things happened');
writeln(E.Message);
end;
end;
finally Thanks for your interest ! Davo |
Edit logs from dumpio -
As you can see, despite my setting of Content-Type = application/json it appears here as application/x-www-form-urlencode but the content itself is not in fact encoded ?? Davo |
There are at least two things you have to fix:
|
OK, you make a lot of sense Korestar ! Now, my free pascal client does not work with the multipass nextcloud and, as you say, the fact its not sending as content-type-json has to be a clue. Trouble is I cannot set any apache logging in the multipass thing, its an applience not a compuer ! So, I'll fiddle with the curl line's url but probably just build another, correct VM and see how that works. I am moving in the right direction, I thank you ! I will report back here when I have made some more progress. Davo |
OK, all working as expected now. My issue was Content-Type - the FP call I was using, PostForm was overwriting json with x-www-form-urlencoded, perhaps because of 'form' ? Anyway, doing
bypassed the overwriting and all worked as expected. And, yes, complicated by a badely built NextCloud VM too ! Sigh ... Thanks Korelstar, I will close this now (hope thats the way its done here). Davo |
Hi Folks, like the project !
I am trying to use the API from a client of my own, while I have no trouble with GET, getting the full list of notes, I cannot POST, post a new note.
I am posting to http://192.168.1.137/nextcloud/index.php/apps/notes/api/v1/notes and sending
{"title":"Some New Note","content":"This is stuff in a new note",}
The new note is created, I get back the new note's ID but its title and content are ignored. The note is created but has a blank title and content.
I can see the post arrive in Apache, DumpIO shows me -
[Tue Aug 25 12:05:52.287857 2020] [dumpio:trace7] [pid 6127] mod_dumpio.c(100): [client 192.168.1.250:37448] mod_dumpio: dumpio_in (data-HEAP): =%7B%22title%22%3A%22Some%20New%20Note%22,%22content%22%3A%22This%20is%20stuff%20in%20a%20new%20note%22,%7D
which is what I would have expected. I am experiencing the same problem on both a multipass snap based thing and a properly installed system.
Can someone suggest how I can debug further ? I have no history with Nextcloud at all !
Davo
The text was updated successfully, but these errors were encountered: