Swagger Blog

Article

getArticleById

Get article by id

Get an article by it's id


/article/{id}

Usage and SDK Samples

curl -X GET "https://blog.swagger.io/v3/article/{id}"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.ArticleApi;

import java.io.File;
import java.util.*;

public class ArticleApiExample {

    public static void main(String[] args) {
        
        ArticleApi apiInstance = new ArticleApi();
        Integer id = 56; // Integer | The only Id of the article for the filter
        try {
            Article result = apiInstance.getArticleById(id);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ArticleApi#getArticleById");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.ArticleApi;

public class ArticleApiExample {

    public static void main(String[] args) {
        ArticleApi apiInstance = new ArticleApi();
        Integer id = 56; // Integer | The only Id of the article for the filter
        try {
            Article result = apiInstance.getArticleById(id);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ArticleApi#getArticleById");
            e.printStackTrace();
        }
    }
}
Integer *id = 56; // The only Id of the article for the filter

ArticleApi *apiInstance = [[ArticleApi alloc] init];

// Get article by id
[apiInstance getArticleByIdWith:id
              completionHandler: ^(Article output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var SwaggerBlog = require('swagger_blog');

var api = new SwaggerBlog.ArticleApi()

var id = 56; // {Integer} The only Id of the article for the filter


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getArticleById(id, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class getArticleByIdExample
    {
        public void main()
        {
            
            var apiInstance = new ArticleApi();
            var id = 56;  // Integer | The only Id of the article for the filter

            try
            {
                // Get article by id
                Article result = apiInstance.getArticleById(id);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling ArticleApi.getArticleById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\ArticleApi();
$id = 56; // Integer | The only Id of the article for the filter

try {
    $result = $api_instance->getArticleById($id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ArticleApi->getArticleById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::ArticleApi;

my $api_instance = WWW::SwaggerClient::ArticleApi->new();
my $id = 56; # Integer | The only Id of the article for the filter

eval { 
    my $result = $api_instance->getArticleById(id => $id);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling ArticleApi->getArticleById: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.ArticleApi()
id = 56 # Integer | The only Id of the article for the filter

try: 
    # Get article by id
    api_response = api_instance.get_article_by_id(id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ArticleApi->getArticleById: %s\n" % e)

Parameters

Path parameters
Name Description
id*
Integer
The only Id of the article for the filter
Required

Responses

Status: 200 - Successful Operation

Status: 400 - Bad Request

Status: 404 - Not Found


getArticles

Get articles

Get the title of the request page of articles


/articles

Usage and SDK Samples

curl -X GET "https://blog.swagger.io/v3/articles?page="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.ArticleApi;

import java.io.File;
import java.util.*;

public class ArticleApiExample {

    public static void main(String[] args) {
        
        ArticleApi apiInstance = new ArticleApi();
        String page = page_example; // String | the request page
        try {
            ArticlesResponse result = apiInstance.getArticles(page);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ArticleApi#getArticles");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.ArticleApi;

public class ArticleApiExample {

    public static void main(String[] args) {
        ArticleApi apiInstance = new ArticleApi();
        String page = page_example; // String | the request page
        try {
            ArticlesResponse result = apiInstance.getArticles(page);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ArticleApi#getArticles");
            e.printStackTrace();
        }
    }
}
String *page = page_example; // the request page

ArticleApi *apiInstance = [[ArticleApi alloc] init];

// Get articles
[apiInstance getArticlesWith:page
              completionHandler: ^(ArticlesResponse output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var SwaggerBlog = require('swagger_blog');

var api = new SwaggerBlog.ArticleApi()

var page = page_example; // {String} the request page


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getArticles(page, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class getArticlesExample
    {
        public void main()
        {
            
            var apiInstance = new ArticleApi();
            var page = page_example;  // String | the request page

            try
            {
                // Get articles
                ArticlesResponse result = apiInstance.getArticles(page);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling ArticleApi.getArticles: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\ArticleApi();
$page = page_example; // String | the request page

try {
    $result = $api_instance->getArticles($page);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ArticleApi->getArticles: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::ArticleApi;

my $api_instance = WWW::SwaggerClient::ArticleApi->new();
my $page = page_example; # String | the request page

eval { 
    my $result = $api_instance->getArticles(page => $page);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling ArticleApi->getArticles: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.ArticleApi()
page = page_example # String | the request page

try: 
    # Get articles
    api_response = api_instance.get_articles(page)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ArticleApi->getArticles: %s\n" % e)

Parameters

Query parameters
Name Description
page*
String
the request page
Required

Responses

Status: 200 - Successful Operation

Status: 404 - Not Found


getCommentsOfArticle

Get all comments of an article

Get all comments of an article


/article/{id}/comments

Usage and SDK Samples

curl -X GET "https://blog.swagger.io/v3/article/{id}/comments"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.ArticleApi;

import java.io.File;
import java.util.*;

public class ArticleApiExample {

    public static void main(String[] args) {
        
        ArticleApi apiInstance = new ArticleApi();
        Integer id = 56; // Integer | The only id of the article to return
        try {
            Comments result = apiInstance.getCommentsOfArticle(id);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ArticleApi#getCommentsOfArticle");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.ArticleApi;

public class ArticleApiExample {

    public static void main(String[] args) {
        ArticleApi apiInstance = new ArticleApi();
        Integer id = 56; // Integer | The only id of the article to return
        try {
            Comments result = apiInstance.getCommentsOfArticle(id);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ArticleApi#getCommentsOfArticle");
            e.printStackTrace();
        }
    }
}
Integer *id = 56; // The only id of the article to return

ArticleApi *apiInstance = [[ArticleApi alloc] init];

// Get all comments of an article
[apiInstance getCommentsOfArticleWith:id
              completionHandler: ^(Comments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var SwaggerBlog = require('swagger_blog');

var api = new SwaggerBlog.ArticleApi()

var id = 56; // {Integer} The only id of the article to return


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getCommentsOfArticle(id, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class getCommentsOfArticleExample
    {
        public void main()
        {
            
            var apiInstance = new ArticleApi();
            var id = 56;  // Integer | The only id of the article to return

            try
            {
                // Get all comments of an article
                Comments result = apiInstance.getCommentsOfArticle(id);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling ArticleApi.getCommentsOfArticle: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\ArticleApi();
$id = 56; // Integer | The only id of the article to return

try {
    $result = $api_instance->getCommentsOfArticle($id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ArticleApi->getCommentsOfArticle: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::ArticleApi;

my $api_instance = WWW::SwaggerClient::ArticleApi->new();
my $id = 56; # Integer | The only id of the article to return

eval { 
    my $result = $api_instance->getCommentsOfArticle(id => $id);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling ArticleApi->getCommentsOfArticle: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.ArticleApi()
id = 56 # Integer | The only id of the article to return

try: 
    # Get all comments of an article
    api_response = api_instance.get_comments_of_article(id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ArticleApi->getCommentsOfArticle: %s\n" % e)

Parameters

Path parameters
Name Description
id*
Integer
The only id of the article to return
Required

Responses

Status: 200 - Successful Operation

Status: 400 - Bad Request

Status: 404 - Not Found


User

createComment

create comment

user creates a comment for the article


/article/{id}/comment

Usage and SDK Samples

curl -X POST "https://blog.swagger.io/v3/article/{id}/comment"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.UserApi;

import java.io.File;
import java.util.*;

public class UserApiExample {

    public static void main(String[] args) {
        
        UserApi apiInstance = new UserApi();
        Integer id = 56; // Integer | 
        Body body = ; // Body | 
        try {
            Comment result = apiInstance.createComment(id, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UserApi#createComment");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.UserApi;

public class UserApiExample {

    public static void main(String[] args) {
        UserApi apiInstance = new UserApi();
        Integer id = 56; // Integer | 
        Body body = ; // Body | 
        try {
            Comment result = apiInstance.createComment(id, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UserApi#createComment");
            e.printStackTrace();
        }
    }
}
Integer *id = 56; // 
Body *body = ; // 

UserApi *apiInstance = [[UserApi alloc] init];

// create comment
[apiInstance createCommentWith:id
    body:body
              completionHandler: ^(Comment output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var SwaggerBlog = require('swagger_blog');

var api = new SwaggerBlog.UserApi()

var id = 56; // {Integer} 

var body = ; // {Body} 


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.createComment(id, body, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class createCommentExample
    {
        public void main()
        {
            
            var apiInstance = new UserApi();
            var id = 56;  // Integer | 
            var body = new Body(); // Body | 

            try
            {
                // create comment
                Comment result = apiInstance.createComment(id, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling UserApi.createComment: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\UserApi();
$id = 56; // Integer | 
$body = ; // Body | 

try {
    $result = $api_instance->createComment($id, $body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling UserApi->createComment: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::UserApi;

my $api_instance = WWW::SwaggerClient::UserApi->new();
my $id = 56; # Integer | 
my $body = WWW::SwaggerClient::Object::Body->new(); # Body | 

eval { 
    my $result = $api_instance->createComment(id => $id, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling UserApi->createComment: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.UserApi()
id = 56 # Integer | 
body =  # Body | 

try: 
    # create comment
    api_response = api_instance.create_comment(id, body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UserApi->createComment: %s\n" % e)

Parameters

Path parameters
Name Description
id*
Integer
Required
Body parameters
Name Description
body *

Responses

Status: 200 - Successful Operation

Status: 400 - Bad Request


signIn

sign in

Check user with username and password


/auth/signin

Usage and SDK Samples

curl -X POST "https://blog.swagger.io/v3/auth/signin"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.UserApi;

import java.io.File;
import java.util.*;

public class UserApiExample {

    public static void main(String[] args) {
        
        UserApi apiInstance = new UserApi();
        User body = ; // User | 
        try {
            inline_response_200 result = apiInstance.signIn(body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UserApi#signIn");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.UserApi;

public class UserApiExample {

    public static void main(String[] args) {
        UserApi apiInstance = new UserApi();
        User body = ; // User | 
        try {
            inline_response_200 result = apiInstance.signIn(body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UserApi#signIn");
            e.printStackTrace();
        }
    }
}
User *body = ; // 

UserApi *apiInstance = [[UserApi alloc] init];

// sign in
[apiInstance signInWith:body
              completionHandler: ^(inline_response_200 output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var SwaggerBlog = require('swagger_blog');

var api = new SwaggerBlog.UserApi()

var body = ; // {User} 


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.signIn(body, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class signInExample
    {
        public void main()
        {
            
            var apiInstance = new UserApi();
            var body = new User(); // User | 

            try
            {
                // sign in
                inline_response_200 result = apiInstance.signIn(body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling UserApi.signIn: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\UserApi();
$body = ; // User | 

try {
    $result = $api_instance->signIn($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling UserApi->signIn: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::UserApi;

my $api_instance = WWW::SwaggerClient::UserApi->new();
my $body = WWW::SwaggerClient::Object::User->new(); # User | 

eval { 
    my $result = $api_instance->signIn(body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling UserApi->signIn: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.UserApi()
body =  # User | 

try: 
    # sign in
    api_response = api_instance.sign_in(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UserApi->signIn: %s\n" % e)

Parameters

Body parameters
Name Description
body *

Responses

Status: 200 - Successful Operation

Status: 404 - Not Found


signUp

sign up

Create a new user with the only username


/auth/signup

Usage and SDK Samples

curl -X POST "https://blog.swagger.io/v3/auth/signup"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.UserApi;

import java.io.File;
import java.util.*;

public class UserApiExample {

    public static void main(String[] args) {
        
        UserApi apiInstance = new UserApi();
        User body = ; // User | Created user object
        try {
            apiInstance.signUp(body);
        } catch (ApiException e) {
            System.err.println("Exception when calling UserApi#signUp");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.UserApi;

public class UserApiExample {

    public static void main(String[] args) {
        UserApi apiInstance = new UserApi();
        User body = ; // User | Created user object
        try {
            apiInstance.signUp(body);
        } catch (ApiException e) {
            System.err.println("Exception when calling UserApi#signUp");
            e.printStackTrace();
        }
    }
}
User *body = ; // Created user object

UserApi *apiInstance = [[UserApi alloc] init];

// sign up
[apiInstance signUpWith:body
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var SwaggerBlog = require('swagger_blog');

var api = new SwaggerBlog.UserApi()

var body = ; // {User} Created user object


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.signUp(body, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class signUpExample
    {
        public void main()
        {
            
            var apiInstance = new UserApi();
            var body = new User(); // User | Created user object

            try
            {
                // sign up
                apiInstance.signUp(body);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling UserApi.signUp: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\UserApi();
$body = ; // User | Created user object

try {
    $api_instance->signUp($body);
} catch (Exception $e) {
    echo 'Exception when calling UserApi->signUp: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::UserApi;

my $api_instance = WWW::SwaggerClient::UserApi->new();
my $body = WWW::SwaggerClient::Object::User->new(); # User | Created user object

eval { 
    $api_instance->signUp(body => $body);
};
if ($@) {
    warn "Exception when calling UserApi->signUp: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.UserApi()
body =  # User | Created user object

try: 
    # sign up
    api_instance.sign_up(body)
except ApiException as e:
    print("Exception when calling UserApi->signUp: %s\n" % e)

Parameters

Body parameters
Name Description
body *

Responses

Status: 200 - Successful Operation

Status: 400 - Bad Requested


Generated 2018-12-16T05:50:00.675Z