Skip to content

Instantly share code, notes, and snippets.

@hamedrnik
Created October 12, 2016 14:08
Show Gist options
  • Select an option

  • Save hamedrnik/7d26c125f5c6ebd056cacb3c0a6271f0 to your computer and use it in GitHub Desktop.

Select an option

Save hamedrnik/7d26c125f5c6ebd056cacb3c0a6271f0 to your computer and use it in GitHub Desktop.
swagger: '2.0'
info:
title: Example API
contact:
name: API support
url: https://example.com/
version: '1.0'
host: example.com
basePath: /api/v1
schemes:
- https
consumes:
- application/x-www-form-urlencoded
produces:
- application/json
paths:
/coverages:
post:
summary: List coverages
operationId: listCoverages
description: >
This endpoint is used for finding story coverages based on
the parameters provided. The maximum number of related stories
returned is 100.
parameters:
- name: story_published_at
type: string
format: date-time
in: formData
description: >
Publish date of the article. If you use a url or title and body of an article
for getting coverages, this parameter is required. The format used is a
restricted form of the canonical representation of dateTime in the
[XML Schema specification (ISO 8601)](https://www.w3.org/TR/xmlschema-2/#dateTime).
responses:
'200':
$ref: '#/responses/coverages'
responses:
coverages:
description: An object including an array of coverages
schema:
$ref: '#/definitions/Coverages'
definitions:
Story:
type: object
properties:
id:
type: integer
format: int64
description: ID of the story which is a unique identification
title:
type: string
description: Title of the story
body:
type: string
description: Body of the story
summary:
$ref: '#/definitions/Summary'
source:
$ref: '#/definitions/Source'
author:
$ref: '#/definitions/Author'
entities:
$ref: '#/definitions/Entities'
keywords:
type: array
items:
type: string
description: Extracted keywords mentioned in the story title or body
hashtags:
type: array
items:
type: string
description: An array of suggested Story hashtags
characters_count:
type: integer
format: int32
description: Character count of the story body
words_count:
type: integer
format: int32
description: Word count of the story body
sentences_count:
type: integer
format: int32
description: Sentence count of the story body
paragraphs_count:
type: integer
format: int32
description: Paragraph count of the story body
categories:
type: array
items:
$ref: '#/definitions/Category'
description: Suggested categories for the story
social_shares_count:
$ref: '#/definitions/ShareCounts'
media:
type: array
items:
$ref: '#/definitions/Media'
description: An array of extracted media such as images and videos
sentiment:
$ref: '#/definitions/Sentiments'
language:
type: string
description: Language of the story
published_at:
type: string
format: date-time
description: Published date of the story
links:
$ref: '#/definitions/StoryLinks'
StoryCluster:
type: object
properties:
id:
type: integer
format: int32
description: A unique identification for the cluster
phrases:
type: array
items:
type: string
description: Suggested labels for the cluster
size:
type: integer
format: int32
description: Size of the cluster
stories:
type: array
items:
type: integer
format: int64
description: Story ids which are in the cluster
score:
type: number
format: double
description: The cluster score
Sentiment:
type: object
properties:
polarity:
type: string
description: Polarity of the sentiment
enum: ['positive', 'neutral', 'negative']
score:
type: number
format: double
description: Polarity score of the sentiment
minimum: 0
maximum: 1
Media:
type: object
properties:
type:
type: string
description: The type of media
enum: ['image', 'video']
url:
type: string
description: A URL which points to the media file
Source:
type: object
properties:
id:
type: integer
format: int32
description: The source id which is a unique value
name:
type: string
description: The source name
title:
type: string
description: The title of the home page URL
description:
type: string
description: A general explanation about the source
links_in_count:
type: integer
format: int32
description: The number of websites that link to the source
home_page_url:
type: string
description: The home page URL of the source
domain:
type: string
description: The domain name of the source which is extracted from the source URL
logo_url:
type: string
description: A URL which points to the source logo
locations:
type: array
items:
$ref: '#/definitions/Location'
description: >
The source locations which are tend to be the physical locations of the source,
e.g. BBC headquarter is located in London.
scopes:
type: array
items:
$ref: '#/definitions/Scope'
description: >
The source scopes which is tend to be scope locations of the source,
e.g. BBC scopes is international.
rankings:
$ref: '#/definitions/Rankings'
Rankings:
type: object
properties:
alexa:
type: array
items:
$ref: '#/definitions/Rank'
Rank:
type: object
properties:
rank:
type: integer
format: int32
description: The rank
country:
type: string
description: The country code which the rank is in it
fetched_at:
type: string
format: date-time
description: The fetched date of the rank
Author:
type: object
properties:
id:
type: integer
format: int64
description: A unique identification for the author
name:
type: string
description: The extracted author full name
avatar_url:
type: string
description: A URL which points to the author avatar
Summary:
type: object
properties:
sentences:
type: array
items:
type: string
description: A summary sentence
description: An array of the suggested summary sentences
Entity:
type: object
properties:
text:
type: string
description: The entity text
score:
type: number
format: double
description: The entity score
maximum: 1
minimum: 0
types:
type: array
items:
type: string
description: A dbpedia type
description: An array of the dbpedia types
links:
$ref: '#/definitions/EntityLinks'
indices:
type: array
items:
type: array
items:
type: integer
format: int32
description: The indices of the entity text
ShareCount:
type: object
properties:
count:
type: integer
format: int32
description: The number of shares
fetched_at:
type: string
format: date-time
description: The fetched date of the shares
Category:
type: object
properties:
id:
type: string
description: The ID of the category
taxonomy:
type: string
description: The taxonomy of the category
enum: ['iab-qag', 'iptc-subjectcode']
level:
type: integer
format: int32
description: The level of the category
score:
type: number
format: double
description: The score of the category
confident:
type: boolean
description: It defines whether the extracted category is confident or not
links:
$ref: '#/definitions/CategoryLinks'
Location:
type: object
properties:
country:
type: string
description: >
The country code of the location. It supports
[ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
country codes.
state:
type: string
description: The state of the location
city:
type: string
description: The city of the location
Scope:
type: object
properties:
country:
type: string
description: >
The source scope by country code. It supports
[ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
country codes.
state:
type: string
description: The scope by state
city:
type: string
description: The scope by city
level:
type: string
description: The scope by level
enum: ['international', 'national', 'local']
Entities:
type: object
properties:
title:
type: array
items:
$ref: '#/definitions/Entity'
description: An array of extracted entities from the story title
body:
type: array
items:
$ref: '#/definitions/Entity'
description: An array of extracted entities from the story body
EntityLinks:
type: object
properties:
dbpedia:
type: string
description: A dbpedia resource URL
CategoryLinks:
type: object
properties:
self:
type: string
description: A URL pointing to the category
parent:
type: string
description: A URL pointing to the parent category
ShareCounts:
type: object
properties:
facebook:
type: array
items:
$ref: '#/definitions/ShareCount'
description: Facebook shares count
google_plus:
type: array
items:
$ref: '#/definitions/ShareCount'
description: Google Plus shares count
linkedin:
type: array
items:
$ref: '#/definitions/ShareCount'
description: LinkedIn shares count
reddit:
type: array
items:
$ref: '#/definitions/ShareCount'
description: Reddit shares count
Sentiments:
type: object
properties:
title:
$ref: '#/definitions/Sentiment'
body:
$ref: '#/definitions/Sentiment'
StoryLinks:
type: object
properties:
permalink:
type: string
description: The story permalink URL
related_stories:
type: string
description: The related stories URL
coverages:
type: string
description: The coverages URL
Coverages:
type: object
properties:
story_title:
type: string
description: The input story title
story_body:
type: string
description: The input story body
story_published_at:
type: string
format: date-time
description: The input story published date
story_language:
type: string
description: The input story language
coverages:
type: array
items:
$ref: '#/definitions/Story'
description: An array of coverages for the input story
clusters:
type: array
items:
$ref: '#/definitions/StoryCluster'
description: An array of clusters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment