# Blackout Dates (Category 11) Footnotes Web Service

The Blackout Dates (Category 11) Footnotes API is used to specify a date or range of dates when travel is not permitted. The API is designed by ATPCO to meet your needs for automated table creation so you can reduce manual input and get your fares to market faster. 

# Request
Your request to the Blackout Dates (Category 11) Footnotes Web Service must provide a valid OAuth Access Token. For instructions on how to obtain and use an OAuth Access Token programmatically, see [Authentication](https://devportal.atpco.net/content-management/default/authentication). You must also specify parameters in the request body.

## Request Header Parameters
See [Authentication](https://devportal.atpco.net/content-management/default/authentication) for instructions on header parameters needed for authentication.

## Request Body
The request body should be formatted as a JSON object (examples below).

## Request Object Parameters
All data requests must be received in the JSON format specified by ATPCO, with field names and sub values found in Data Application unless otherwise specified (fields and sub values (i.e., parameters) detailed below). Field names and provided values must be enclosed in quotation marks (e.g., `"tvlDtExp"`).

* `""` or `"  "` as a field name or field value: an empty or non-empty blank string within quotation marks in the request is ignored and will not appear in the JSON response
* Invalid field names in a request are ignored
* Invalid field values in a request generate an error 

If your request contains field names that are invalid in a request yet valid in a response (e.g., `msgs` or `msg`), those fields will be eliminated during processing and overlaid when necessary in the response.

All String fields (enclosed in double quotes) will have leading and trailing spaces removed unless removing all blanks would violate a possible value for a field where blank(s) is valid on a JSON request. Some fields may have special leading/trailing blanks removal Footnotes such as `NoteText996`, where only trailing blanks are removed to preserve any intentional text indentations.

*Examples of invalid field names and values*

| Field Name | Value | Issue | System Handling |
| ---------- | ----- | ----- | --------------- |
| `" tvlDtExp"` | &nbsp; | Extra leading space | ignored |
| `"tvlDtExp "` | &nbsp; | Extra trailing space | ignored |
| `"tvlDExp"` | &nbsp; | Field name incorrect. Missing 't' | ignored |
| &nbsp; | `" WAS"` | Extra leading space | Error invalid city format |

The request object can include any of the following parameters:

### Category 11 Parameters
| Field Name | Description | Type | Format | Example |
| ---------- | ----------- | ---- | ------ | ------- |
| `blkOutDts11` | Wrapper for Category 11 domain | Collection of key-value pairs | &nbsp; | `{ }` |
| `startDt` | The first date or the first date in a for a range of dates travel is NOT permitted  | String | "YYYYMMDD"=full date<br>"MMDD"=month and day with no year | `"20180930"` |
| `stopDt` | The last date or the last date in a for a range of dates travel is NOT permitted | String | "YYYYMMDD"=full date<br>"MMDD"=month and day with no year | `"20180930"` |

### 994 Override Date Fields	
| Field Name | Description | Type | Format | Example |
| ---------- | ----------- | ---- | ------ | ------- |
| `ovrrdDt994` | Wrapper for 994 Subdomain | Collection of key-value pairs | &nbsp; | `{ }` |
| `tvlEff` | The first date travel is valid for the Category Record 3 provisions | String | YYYYMMDD | `"20180930"` |
| `tvlDisc` | The last date travel is valid for the Category Record 3 provisions | String | YYYYMMDD | `"20180930"` |
| `tktEff` | The first date ticketing is valid for the Category Record 3 provisions | String | YYYYMMDD | `"20180930"` |
| `tktDisc` | The last date ticketing is valid for the Category Record 3 provisions | String | YYYYMMDD | `"20180930"` |
| `rsvEff` | The first date reservations can be made for the Category Record 3 provisions | String | YYYYMMDD | `"20180930"` |
| `rsvDisc` | The last date reservations can be made for the Category Record 3 provisions | String | YYYYMMDD | `"20180930"` |

### 996 Note Text
| Field Name | Description | Type | Format | Example |
| ---------- | ----------- | ---- | ------ | ------- |
| `noteTxt996` | Wrapper for 996 Table | Collection of key-value pairs | &nbsp; | `{ }` |
| `txtLns` | Collection of lines of free-form text specified in the request | Array of collections of key-value pairs | &nbsp; | `[ { "lnNum": "1", "txt": "THIS IS SAMPLE NOTE TEXT" }, ... ]` |
| `lnNum` | Line number indicating the placement of the associated `txt` field | String | # | `"1"` |
| `txt` | The text to be printed at the corresponding `lnNum` (line number) | String | Free-form text | `"THIS IS SAMPLE NOTE TEXT"` |


### General Fields
| Field Name | Description | Type | Format | Example |
| ---------- | ----------- | ---- | ------ | ------- |
| `rtnTblNumsOnly` | Indicates whether to display the created table numbers and the data values specified in the Request. When set to `"Y"` (True), ONLY the table numbers will display in the Response. Default is `"N"` (False). | String (max 1-character) | `"Y"` = True; `"N"` = False | `"N"` |
| `tblNum` | Indicates an existing 900 series table in a request or generated in a response when data has been created | String | ##### | `"4035046"` |

# Response
Responses from the Blackout Dates (Category 11) Footnotes Web Service use the same parameters as requests, outlined above. Responses can also include `msg` and `msgs`, which are used to communicate error messages.

# Example Requests and Responses

## Simple Category Request
(display only table numbers in response)
**Request**
```javascript
{
  "rtnTblNumsOnly":"Y",

  "blkOutDts11": {
    "startDt": "20180930",
	"stopDt": "20181030"
	
  }
}
```
**Response**
```javascript
{
  "rtnTblNumsOnly": "Y",
  "blkOutDts11": {
    "tblNum": "4035046"
  }
}
```

## Simple Category Request with Supporting Table 994
(display table numbers and values in response) 
**Request**
```javascript
{
  "rtnTblNumsOnly":"N",

  "blkOutDts11": {
    "startDt": "20180930",
	"stopDt": "20181030",
    "ovrrdDt994": {
      "rsvEff": "20180101"
    }
  }
}
```
**Response**
```javascript
{
  "rtnTblNumsOnly": "N",
  "blkOutDts11": {
    "tblNum": "4034902",
    "startDt": "20180930",
	"stopDt": "20181030",
    "ovrrdDt994": {
      "tblNum": "58696",
      "rsvEff": "20180101"
    }
  }
}
```

## Full Category Request
(display only table numbers in response)
**Request**
```javascript
{
  "rtnTblNumsOnly":"Y",


  "blkOutDts11": {
    "startDt": "20180201",
    "stopDt": "20181030",
    "ovrrdDt994": {
      "rsvEff": "20180101",
      "rsvDisc": "20180731",  
      "tktDisc": "20180731",
      "tvlEff": "20180201",
      "tvlDisc": "20181030"
    },
    "noteTxt996": {
      "txtLns": [{"lnNum":"1","txt": "THIS IS SAMPLE NOTE TEXT TO ILLUSTRATE"}
                ,{"lnNum":"2","txt": "          INDENTATION AND LINE BREAKS"}
                ,{"lnNum":"3","txt": "                IN YOUR REQUEST AND RESPONSE."}
                ,{"lnNum":"4","txt": "WE HOPE THAT YOU ARE ENJOYING OUR DEMO.."}]
    },
        }
}
```
**Response**
```javascript
{
  "rtnTblNumsOnly": "Y",

  "blkOutDts11": {
    "tblNum": "4035073",
    "ovrrdDt994": {
      "tblNum": "58746"
    },
    "noteTxt996": {
      "tblNum": "8187666"
    }
  }
}
```

## Simple Category Request Using Data and Existing Table Number
(display table number and values in response)
**Request**
```javascript
{
  "rtnTblNumsOnly":"N",
  "blkOutDts11": {
    "startDt": "20180930",
	"stopDt": "20181030",
    "ovrrdDt994": {
      "tblNum": "12345678",
    }
  }
}
```
**Response**
```javascript
{
  "rtnTblNumsOnly": "N",
  "blkOutDts11": {
    "tblNum": "4034902",
	"startDt": "20180930",
	"stopDt": "20181030",
    "ovrrdDt994": {
      "tblNum": "12345678",
		
    }
  }
}
```

## GOLD Environment Endpoints
[https://gold.apis.atpco.net/blackoutdatesfootnotes-gold/api/v1/footnotes/blackoutdates](https://gold.apis.atpco.net/blackoutdatesfootnotes-gold/api/v1/footnotes/blackoutdates)
