0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Airtableのapi(json型)をajaxで取得する。(備忘録)

0
Posted at

今回自身の制作で手をつけていたAirtableのAPI取得についての備忘録

今回はAirtableのAPI取得して、コンソール上に表示まで

index.html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>  
    <script src="js/info.js"></script>
</head>
<body>
<script>


jQuery.ajax({
    url: "jsonデータのURL",
    type: "GET", //値をGET
    data: {
        //各項目の中身
        "view": "Main View", 
        "limit": "10",
        "offset": "",
        "sortField": "Name",
        "sortDirection": "asc",
    },
    headers: {
        //APIkeyを入力する
        "Authorization": "APIkeyを入力",
    },
})
.done(function(data, textStatus, jqXHR) {
    //dataの中身を表示する
    console.log(data);
})


</script>
</body>
</html>

上記のコードでlocalhostから見てみるとコンソールに下のようなものが出力されます。

スクリーンショット 2016-06-11 16.49.01.png

fieldsの中身がAirtableで書いた行のところになります。
上の画像では、 Name mizugasira Notes masaya となっているのがわかると思います。

いやー初めてAirtable触ったが楽しかった気がする。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?