Nothing Special   »   [go: up one dir, main page]

API Docs

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

GSA Example API Docs

Overview
This section should contain an overview of the data provided and the API purpose.

USING THE API

We built the API to be as self-documenting as possible, but if you find yourself


overwhelmed, we organized this site into four major areas.

 Getting started introduces you to the operations offered by the API.


 API calls gives you a hands-on experience of those operations with an interactive
console.
 Field reference lists and describes the type of information provided by the API.
 Frequently Asked Questions (FAQ) Here are answers to some frequently asked
questions.
 Contact Us If you need support or need to get in touch, this is the place to look.

Getting Started
The current version of the API lives at  https://api.gsa.gov/v3/path .

 One example of a way to use it.


 Another example of a way to use it.

Versions

Version Date Changes

version 1/1/2095 Initial deployment


1

version 3/1/2096 Changed data structure to fit congressional mandate


Version Date Changes

version 3/1/2099 Request pattern changed for new requirements


3

Endpoints

Endpoint What it does

Returns an array of Airfares based on query parameters


/citypairs/airfares

Returns an array of Airfares based on unique identifier. Array


/citypairs/airfares/ will contain one airfare. (This is just for demonstration purpose.
{id} For City Pairs, the ID does not have meaning.)

API calls
Explore the API here hands-on.

This API supports a data response in JSON format.

You can view the definition of this API in OpenAPI Specification 2.0 format in this
file: citypairs.json

Need a little help? Read our Getting Started to learn about using the API.
Prototype City Pairs API

Prototype project to demonstrate GSA API Standards and API Documentation Template.


o Show/Hide

o List Operations

o Expand Operations

o
 GET /airfares

Negotiated airfares

 IMPLEMENTATION NOTES

 This endpoint returns negotiated airfaires.


 RESPONSE CLASS (STATUS 200)

 An array of airfares
 Model

 Example Value

 [

 {

 "ID": 0,

 "ITEM_NUM": "string",

 "AWARD_YEAR": "string",

 "ORIGIN_AIRPORT_ABBREV": "string",

 "DESTINATION_AIRPORT_ABBREV": "string",

 "ORIGIN_CITY_NAME": "string",

 "ORIGIN_STATE": "string",

 "ORIGIN_COUNTRY": "string",

 "DESTINATION_CITY_NAME": "string",

 "DESTINATION_STATE": "string",

 "DESTINATION_COUNTRY": "string",

 "AIRLINE_ABBREV": "string",

 "AWARDED_SERV": "string",

 "PAX_COUNT": "string",

 "YCA_FARE": 0,

 "XCA_FARE": 0,

 "BUSINESS_FARE": 0,

 "ORIGIN_AIRPORT_LOCATION": "string",

 "DESTINATION_AIRPORT_LOCATION": "string",

 "ORIGIN_CITY_STATE_AIRPORT": "string",

 "DESTINATION_CITY_STATE_AIRPORT": "2019-04-17T12:22:16.807Z",

 "EFFECTIVE_DATE": "2019-04-17T12:22:16.807Z",
 "EXPIRATION_DATE": "2019-04-17T12:22:16.807Z"

 }

Response Content Type  


PARAMETERS

Parameter
Parameter Value Description Data Type
Type

award_year query string


Year of airfare award.
Example: '2017'

origin_airport_abbrev query string


Origin airport abbreviation.
Example: 'ABQ'. Must include
either this or the destination
airport abbreviation.

destination_airport_abbre query string


Destination airport
v
abbreviation. Example: 'BWI'.
Must include either this or the
origination airport
abbreviation.

RESPONSE MESSAGES

HTTP Status
Reason Response Model Headers
Code

default Model
Unexpected error
Example Value

"message": "string",
HTTP Status
Reason Response Model Headers
Code

"required_fields": "string",

"example": "string"

Try it out!

 GET /airfares/{id}

Individual airfare by ID

 IMPLEMENTATION NOTES

 This endpoint returns one airfare by ID. (This is just for


demonstration purpose. For City Pairs, the ID does not have meaning.)
 RESPONSE CLASS (STATUS 200)

 An array of airfares
 Model

 Example Value

 [

 {

 "ID": 0,

 "ITEM_NUM": "string",

 "AWARD_YEAR": "string",

 "ORIGIN_AIRPORT_ABBREV": "string",

 "DESTINATION_AIRPORT_ABBREV": "string",

 "ORIGIN_CITY_NAME": "string",

 "ORIGIN_STATE": "string",

 "ORIGIN_COUNTRY": "string",

 "DESTINATION_CITY_NAME": "string",

 "DESTINATION_STATE": "string",

 "DESTINATION_COUNTRY": "string",
 "AIRLINE_ABBREV": "string",

 "AWARDED_SERV": "string",

 "PAX_COUNT": "string",

 "YCA_FARE": 0,

 "XCA_FARE": 0,

 "BUSINESS_FARE": 0,

 "ORIGIN_AIRPORT_LOCATION": "string",

 "DESTINATION_AIRPORT_LOCATION": "string",

 "ORIGIN_CITY_STATE_AIRPORT": "string",

 "DESTINATION_CITY_STATE_AIRPORT": "2019-04-17T12:22:16.841Z",

 "EFFECTIVE_DATE": "2019-04-17T12:22:16.842Z",

 "EXPIRATION_DATE": "2019-04-17T12:22:16.842Z"

 }

Response Content Type  


PARAMETERS

Parameter
Parameter Value Description Data Type
Type

id path integer
Unique identifier

RESPONSE MESSAGES

HTTP Status
Reason Response Model Headers
Code

default Model
Unexpected error
Example Value

"message": "string",

"required_fields": "string",
HTTP Status
Reason Response Model Headers
Code

"example": "string"

Try it out!

[ BASE URL: /TRAVEL/CITYPAIRS/V0 , API VERSION: 0.0.0 ]


Field reference for Sample API data
The fields below are returned in the Sample API.

Add additional information about fields.

EXAMPLE API FIELDS

Field name Description Data type

Unique identifier. string


ID

Item number. string


ITEM_NUM

Award Year. string


AWARD_YEAR

Origin Airport Abbreviation. string


ORIGIN_AIRPORT_ABBREV

Destination Airport Abbreviation. string


DESTINATION_AIRPORT_ABBREV

Origin City Name. string


ORIGIN_CITY_NAME

Origin State. string


ORIGIN_STATE
Field name Description Data type

Origin Country. string


ORIGIN_COUNTRY

Destination City Name. string


DESTINATION_CITY_NAME

Destination State. string


DESTINATION_STATE

Destination Country. string


DESTINATION_COUNTRY

Airline Abbreviation. string


AIRLINE_ABBREV

Awarded Serv. string


AWARDED_SERV

PAX Count. string


PAX_COUNT

YCA Fare. string


YCA_FARE

XCA Fare. string


XCA_FARE

Business Fare. string


BUSINESS_FARE

Origin Airport Location. string


ORIGIN_AIRPORT_LOCATION

Destination Airport Location. string


DESTINATION_AIRPORT_LOCATION

Origin City State Airport. string


ORIGIN_CITY_STATE_AIRPORT
Field name Description Data type

Destination City State Airport. string


DESTINATION_CITY_STATE_AIRPORT

Expiration Date. string


EXPIRATION_DATE
Sample API Documentation
INTRODUCTION
Sample api documentation for sample project.

Allowed HTTPs requests:


PUT : To create resource

POST : Update resource

GET : Get a resource or list of resources

DELETE : To delete resource

Description Of Usual Server Responses:


 200  OK  - the request was successful (some API calls may return 201 instead).
 201  Created  - the request was successful and a resource was created.
 204  No Content  - the request was successful but there is no representation to
return (i.e. the response is empty).
 400  Bad Request  - the request could not be understood or was missing
required parameters.
 401  Unauthorized  - authentication failed or user doesn't have permissions for
requested operation.
 403  Forbidden  - access denied.
 404  Not Found  - resource was not found.
 405  Method Not Allowed  - requested method is not supported for resource.

Some sample
Test sample | test column two First column sadf asdfads | sfsdsadf

test one | Another column


Table sample
First Column Second Column

First Column Second Column

Code Sample
Some code here
REFERENCE

User

Represents user details.

User attributes:
 id  (Number)  : unique identifier.
 fname  (String)  : First Name.
 lname  (String)  : Last Name.
 email  (String)  : email id of the user.

User Collection

List all users

Retrieve paginated list of users.

Create a User

User/User Collection/List all users


GET http://sample.pandurangpatil.com/users(?since,limit)
Parameters

 since
Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ Only users updated at or after
this time are returned.
String
 limit
maximum number of records expected by client.
Number
Request
Production
Raw
Try
Response
200

HEADERS

 Content-Type:application/json
BODY
[
{
"id": 1,
"fname": "Pandurang",
"lname": "Patil",
"email": "pandurang@email.com"
},
{
"id": 2,
"fname": "Sangram",
"lname": "Shinde",
"email": "sangram@email.com"
}
]
Response
401

HEADERS

 Content-Type:application/json
BODY
{
"error": "error.unauthorized"
}

User
A single User object with all its details
Retrieve a User

Update a User

Update user details

Remove a User

You might also like