# PPTCValuationAPI
## Request
### API名
| NAME |
| -------- |
| PPTCValuationAPI |
### URL
| Environment| Name |
| -------- | -------- |
| dev | https://dbnlzch3c8.execute-api.ap-northeast-1.amazonaws.com/dev-pptc-valuation/pptc-valuation|
| stg | https://dbnlzch3c8.execute-api.ap-northeast-1.amazonaws.com/dev-pptc-valuation/pptc-valuation|
| prd | https://oqtb61ylu1.execute-api.ap-northeast-1.amazonaws.com/prd-pptc-api/valuation |
### HTTPメソッド
| HTTPメソッド |
| -------- |
| POST |
### Header
| Key | Value |
| -------- | -------- |
| Content-Type | application/json |
### Body
| Column | Type | Required | Description
| -------- | -------- | -------- | -------- |
| property | array | true | array(property表を確認)|
| email | string | true | メールアドレス|
| created_at | datetime | true | 作成日時|
| callback_url | string | true | コールバックURL|
### property
| Column | Type | Required | Description |
| -------- | -------- | -------- | -------- |
| name | string | true | 物件名 |
| zip | string | true | 郵便番号 |
| address | string | true | 住所 |
| built_at | string | true | 築年数 |
| floors | string | true | 総階数|
| locality_floor | string | true | 所属階数|
| exclusive_area | string | true | 専有面積 |
- リクエスト例
```
URL:
https://dbnlzch3c8.execute-api.ap-northeast-1.amazonaws.com/dev-pptc-valuation/pptc-valuation
Header:
{
Content-Type: application/json
}
Body:
{
"property": {
"name": "hogehoge",
"zip": "12345678",
"address": "東京都hogehoge",
"built_at": "2000",
"floors": "10",
"locality_floor": "1",
"exclusive_area": "100"
},
"email": "hogehoge@hogehoge.com",
"created_at": "2022-01-01 00:00:00"
"callback_url": "https://hogehoge.come/hogehoge"
}
```
## Request
### Header
| Key | Value |
| -------- | -------- |
| Content-Type | application/json |
### Body
| Column | Type | Description|
| -------- | -------- | -------- |
| message | string | メッセージ |
| valuation_id | string | 査定ID |
- レスポンス例
status: 200
```
{
"message": "success",
"valuation_id": "47ac9fe2-2f7a-40b2-9dd0-e3acf456e5a8"
}
```
status: 403
```
{
"{'property': [{'name': ['required field']}]}"
}
```
status:415
```
{
"message": "Unsupported Media Type"
}
```
## Webhook
### URL
RequestBody内のcallback_urlにリクエストする
### HTTPメソッド
| HTTPメソッド |
| -------- |
| POST |
### IP
| Environment | IP |
| -------- | -------- |
| dev | 52.196.58.51 |
| stg | 52.196.58.51 |
| prd | 35.75.24.242 |
### Body
| Column | Type | Description |
| -------- | -------- | -------- |
| valuation_id | string | 査定依頼ID |
| value | int | 査定金額 |
| valueRange | array |査定金額レンジ(査定金額レンジ表を参照) |
### valueRange(査定金額レンジ)
| Column | Type | Description |
| -------- | -------- | -------- |
| lower | int | 査定金額(下限)|
| upper | int | 査定金額(上限)|
- Webhook例
status: 200
```
URL:
Request['callback_url']
Header:
{
Content-Type: application/json
}
Body:
{
"valuation_id": "47ac9fe2-2f7a-40b2-9dd0-e3acf456e5a8",
"value": 14100000,
"valueRange": {
"lower": 13000000,
"upper": 15300000
}
}
```
status: 400
```
{
'status_code': 400,
'message': 'The conditional request failed'
}
```
```
{
'status_code': 400, 'message': '{"message": "username: Missing data for required field."}'
}
```
status: 404
```
{
'status_code': 404,
'message': '<h1>Not Found</h1><p>The requested resource was not found on this server.</p>'
}
```