createComment
Create a new comment
/api/v1/posts/{id}/comments
Usage and SDK Samples
curl -X POST \
-H "Accept: application/json" \
"http://localhost:8443/api/v1/posts/{id}/comments?request="
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.RestCommentsControllerApi;
import java.io.File;
import java.util.*;
public class RestCommentsControllerApiExample {
public static void main(String[] args) {
// Create an instance of the API class
RestCommentsControllerApi apiInstance = new RestCommentsControllerApi();
Long id = 789; // Long |
CreateCommentRequest request = ; // CreateCommentRequest |
try {
SimpleCommentDTO result = apiInstance.createComment(id, request);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling RestCommentsControllerApi#createComment");
e.printStackTrace();
}
}
}
import 'package:openapi/api.dart';
final api_instance = DefaultApi();
final Long id = new Long(); // Long |
final CreateCommentRequest request = new CreateCommentRequest(); // CreateCommentRequest |
try {
final result = await api_instance.createComment(id, request);
print(result);
} catch (e) {
print('Exception when calling DefaultApi->createComment: $e\n');
}
import org.openapitools.client.api.RestCommentsControllerApi;
public class RestCommentsControllerApiExample {
public static void main(String[] args) {
RestCommentsControllerApi apiInstance = new RestCommentsControllerApi();
Long id = 789; // Long |
CreateCommentRequest request = ; // CreateCommentRequest |
try {
SimpleCommentDTO result = apiInstance.createComment(id, request);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling RestCommentsControllerApi#createComment");
e.printStackTrace();
}
}
}
// Create an instance of the API class
RestCommentsControllerApi *apiInstance = [[RestCommentsControllerApi alloc] init];
Long *id = 789; // (default to null)
CreateCommentRequest *request = ; // (default to null)
// Create a new comment
[apiInstance createCommentWith:id
request:request
completionHandler: ^(SimpleCommentDTO output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var OpenApiDefinition = require('open_api_definition');
// Create an instance of the API class
var api = new OpenApiDefinition.RestCommentsControllerApi()
var id = 789; // {Long}
var request = ; // {CreateCommentRequest}
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.createComment(id, request, callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class createCommentExample
{
public void main()
{
// Create an instance of the API class
var apiInstance = new RestCommentsControllerApi();
var id = 789; // Long | (default to null)
var request = new CreateCommentRequest(); // CreateCommentRequest | (default to null)
try {
// Create a new comment
SimpleCommentDTO result = apiInstance.createComment(id, request);
Debug.WriteLine(result);
} catch (Exception e) {
Debug.Print("Exception when calling RestCommentsControllerApi.createComment: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\RestCommentsControllerApi();
$id = 789; // Long |
$request = ; // CreateCommentRequest |
try {
$result = $api_instance->createComment($id, $request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling RestCommentsControllerApi->createComment: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::RestCommentsControllerApi;
# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::RestCommentsControllerApi->new();
my $id = 789; # Long |
my $request = ; # CreateCommentRequest |
eval {
my $result = $api_instance->createComment(id => $id, request => $request);
print Dumper($result);
};
if ($@) {
warn "Exception when calling RestCommentsControllerApi->createComment: $@\n";
}
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = openapi_client.RestCommentsControllerApi()
id = 789 # Long | (default to null)
request = # CreateCommentRequest | (default to null)
try:
# Create a new comment
api_response = api_instance.create_comment(id, request)
pprint(api_response)
except ApiException as e:
print("Exception when calling RestCommentsControllerApi->createComment: %s\n" % e)
extern crate RestCommentsControllerApi;
pub fn main() {
let id = 789; // Long
let request = ; // CreateCommentRequest
let mut context = RestCommentsControllerApi::Context::default();
let result = client.createComment(id, request, &context).wait();
println!("{:?}", result);
}
Scopes
Parameters
Name | Description |
---|---|
id* |
Long
(int64)
Required
|
Name | Description |
---|---|
request* |
CreateCommentRequest
Required
|