It looks like you're new here. If you want to get involved, click one of these buttons!
Sorry for the questions, but I'm new with those kind of things (first year of Computer Science).
The thing I'm trying to do is to add (for example) a category automatically whenever I add a new group in my website, which is in the same server as the Forum, or to sync the profile images between the website and forum.
SSO is already enabled and working, and I can retrieve information with GET requests, but I didn't understand how to make POST requests.
I have 2 situations (and need both working):
But I'm getting Code:400, API.Error.ContentType.
The Content-Type in the Request Header is: "Content-Type:application/json; charset=UTF-8".
2) Just sending a request via curl (PHP)
$data = array( "Name" => "Test", "Body" => "Test API call", "CategoryID" => "5" ); $data_string = json_encode($data); $ch = curl_init('http://mywebsite/Forum/api/discussions'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string)) ); $result = curl_exec($ch); $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $contenttype = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); print "Status: $httpcode" . "\n"; print "Content-Type: $contenttype" . "\n"; print "\n" . $result . "\n";
But in this case I'm getting Code: 401, API.Error.AuthRequired, because I'm not sendind the cookies.
I tried everything with Postman (like the tutorial that i found in this Forum, but with session auth), and I'm getting a third error: Code: 400,
"Corpo è richiesto. Categoria è richiesto. Nome è richiesto." (=Body required. Category required. Name required.).
Can you please help me?
I tried to figure it out by myself, but my knowledge about those things it's zero and google didn't helped.