PyJWT で Apple Music API の Developer Token を作成する

下記を参考にしつつ、Developer Token の作成と Apple 公式のテスト URL での確認を行いました。

手順をメモしておきますが、前提として Apple Developer で Media ID と秘密鍵の作成が終わっている必要があります。

  1. PyJWT と cryptography のインストール
  2. 秘密鍵ファイルの確認
  3. Developer Token の作成
  4. curl コマンドでアクセス確認
  5. B'z を検索してみる

PyJWT と cryptography のインストール

まず pip で PyJWT をインストールします。

% pip install pyjwt
Collecting pyjwt
  Downloading https://files.pythonhosted.org/packages/40/46/505f0dd53c14096f01922bf93a7abb4e40e29a06f858abbaa791e6954324/PyJWT-2.6.0-py3-none-any.whl
Installing collected packages: pyjwt
Successfully installed pyjwt-2.6.0

そして cryptography もインストールします。Apple 指定の ES256 での処理には必要だそうです。

% pip install cryptography
Collecting cryptography
  Downloading cryptography-38.0.3-cp36-abi3-macosx_10_10_x86_64.whl (2.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.8/2.8 MB 12.3 MB/s eta 0:00:00
Collecting cffi>=1.12
  Downloading cffi-1.15.1-cp38-cp38-macosx_10_9_x86_64.whl (178 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 178.9/178.9 kB 817.2 kB/s eta 0:00:00
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Installing collected packages: pycparser, cffi, cryptography
Successfully installed cffi-1.15.1 cryptography-38.0.3 pycparser-2.21

秘密鍵ファイルの確認

今回は秘密鍵作成時にダウンロードした .p8 ファイルから直接秘密鍵を読み込んで使います。

一旦ファイルが読み込めるか確認します。不慣れなので。。。

>>> f = open('AuthKey_A1BC2DE34F.p8','r')
>>> f.read()
'-----BEGIN PRIVATE KEY-----\nMIGTBgEBMCMGCyqGSM49BgEGBBqGSM49BwEHCHkwdwICBQQg1nVJd1PhibK9odZT\n3yzf1MzRHmtSx2qXmqU5458MW/BgBgYIKoZIzj1DBQehRBNBBBSIDgBHsm//5jXy\nDTqW3JQmqbwwDhMEOb1fk+Cd6Gc681B3CtSubCz5bm9zcO/kMpasgLhM4CTmYoJE\nmMhVfb7q\n-----END PRIVATE KEY-----'
>>> 

無事、ファイルが読み込まれていますね。秘密鍵はダミーのものに書き換えてあります。

Developer Token の作成

では仕切り直してもう一度。

jwt の encode メソッドを実行して、ヘッダ、ペイロード、サインの 3 つがエンコード & 「.」で連結された文字列を吐き出します。これが Developer Token になります。

ヘッダーとペイロードに渡す内容はこちらを、コードの書き方についてはこちらを参考にしています。

>>> import jwt
>>> f = open('AuthKey_A1BC2DE34F.p8','r')
>>> key = f.read()
>>> jwt.encode(
...     {"iss": "Z98Y76543X","iat": 1667892347,"exp": 1667978747},
...     key,
...     algorithm = "ES256",
...     headers = {"kid": "A1BC2DE34F"}
... )
'eyJhbGc_o_JFUzIoN_IsImtpZBI6Iks3XEs1XUI1oFE_LBJoeXB_o_JKVoQ_fQ.eyJpc3M_o_JaoXlENXc3MjZUI_w_aWFoIjoxNDM3MXc5MDM1LBJleHB_ojEooXMyoXgxMDA9.QgQS5gv75mSJMw5Hw5rIoUFUx1-IYyXIsau_Lkv6oMS-GKeLk_XuIWW6aRZ-Ex3-7KUAzMJIR5yHznvw5XIkkB'
>>> 

Apple の公式ドキュメントに記載のサンプルコードに当てはめて curl コマンドを実行します。

curl コマンドでアクセステスト

% curl -v -H 'Authorization: Bearer eyJhbGc_o_JFUzIoN_IsImtpZBI6Iks3XEs1XUI1oFE_LBJoeXB_o_JKVoQ_fQ.eyJpc3M_o_JaoXlENXc3MjZUI_w_aWFoIjoxNDM3MXc5MDM1LBJleHB_ojEooXMyoXgxMDA9.QgQS5gv75mSJMw5Hw5rIoUFUx1-IYyXIsau_Lkv6oMS-GKeLk_XuIWW6aRZ-Ex3-7KUAzMJIR5yHznvw5XIkkB' "https://api.music.apple.com/v1/test"

重要なのは後半、HTTP のレスポンスが「200」で返ってきている部分です。

*   Trying 23.56.16.9:443...
* Connected to api.music.apple.com (23.56.16.9) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: businessCategory=Private Organization; jurisdictionCountryName=US; jurisdictionStateOrProvinceName=California; serialNumber=C0806592; C=US; ST=California; L=Cupertino; O=Apple Inc.; OU=management:idms.group.1208920; CN=itunes.apple.com
*  start date: Apr 25 16:27:49 2022 GMT
*  expire date: May 25 16:27:48 2023 GMT
*  subjectAltName: host "api.music.apple.com" matched cert's "api.music.apple.com"
*  issuer: C=US; O=Apple Inc.; CN=Apple Public EV Server RSA CA 2 - G1
*  SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7fb56e811c00)
> GET /v1/test HTTP/2
> Host: api.music.apple.com
> user-agent: curl/7.79.1
> accept: */*
> authorization: Bearer eyJhbGc_o_JFUzIoN_IsImtpZBI6Iks3XEs1XUI1oFE_LBJoeXB_o_JKVoQ_fQ.eyJpc3M_o_JaoXlENXc3MjZUI_w_aWFoIjoxNDM3MXc5MDM1LBJleHB_ojEooXMyoXgxMDA9.QgQS5gv75mSJMw5Hw5rIoUFUx1-IYyXIsau_Lkv6oMS-GKeLk_XuIWW6aRZ-Ex3-7KUAzMJIR5yHznvw5XIkkB
> 
< HTTP/2 200 
< server: 4.0.0
< content-type: application/json
< content-length: 0
< x-apple-jingle-correlation-key: Y4JI7FBYVWF6I6MSJMT6OBPQMQ
< x-apple-request-uuid: c7128f94-38ad-8be4-7992-4b27e705f064
< b3: c7128f9438ad8be479924b27e705f064-382f7c8a2052e4cc
< x-b3-traceid: c7128f9438ad8be479924b27e705f064
< x-b3-spanid: 382f7c8a2052e4cc
< apple-seq: 0.0
< apple-tk: false
< apple-originating-system: MZStorePlatform
< x-apple-application-site: ST11
< x-apple-application-instance: 2534168
< x-responding-instance: MZStorePlatform:2534168:::
< apple-timing-app: 7 ms
< access-control-allow-origin: *
< strict-transport-security: max-age=31536000; includeSubDomains
< is-jetty: true
< x-apple-lokamai-no-cache: true
< x-daiquiri-instance: daiquiri:41896001:st53p00it-qujn12040301:7987:22RELEASE167:daiquiri-amp-store-l7shared-int-001-st
< x-daiquiri-instance: daiquiri:42282006:st53p00it-qujn15040502:7987:22RELEASE167:daiquiri-amp-store-l7shared-ext-001-st
< expires: Tue, 08 Nov 2022 11:30:33 GMT
< cache-control: max-age=0, no-cache, private
< pragma: no-cache
< date: Tue, 08 Nov 2022 11:30:33 GMT
< x-cache: TCP_MISS from a23-55-45-84.deploy.akamaitechnologies.com (AkamaiGHost/10.10.1-44825277) (-)
< vary: Accept-Encoding
< vary: Accept-Encoding
< 
* Connection #0 to host api.music.apple.com left intact
% 

ついでに URL の部分を検索用のものに変えてみます。

「"https://api.music.apple.com/v1/catalog/jp/search?term=B'z&types=artists"」

で、実行。

% curl -v -H 'Authorization: Bearer eyJhbGc_o_JFUzIoN_IsImtpZBI6Iks3XEs1XUI1oFE_LBJoeXB_o_JKVoQ_fQ.eyJpc3M_o_JaoXlENXc3MjZUI_w_aWFoIjoxNDM3MXc5MDM1LBJleHB_ojEooXMyoXgxMDA9.QgQS5gv75mSJMw5Hw5rIoUFUx1-IYyXIsau_Lkv6oMS-GKeLk_XuIWW6aRZ-Ex3-7KUAzMJIR5yHznvw5XIkkB' "https://api.music.apple.com/v1/catalog/jp/search?term=B'z&types=artists"

するとレスポンスの最後、B'z にまつわる情報が返ってきているのが分かるかと思います。

*   Trying 23.56.16.9:443...
* Connected to api.music.apple.com (23.56.16.9) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: businessCategory=Private Organization; jurisdictionCountryName=US; jurisdictionStateOrProvinceName=California; serialNumber=C0806592; C=US; ST=California; L=Cupertino; O=Apple Inc.; OU=management:idms.group.1208920; CN=itunes.apple.com
*  start date: Apr 25 16:27:49 2022 GMT
*  expire date: May 25 16:27:48 2023 GMT
*  subjectAltName: host "api.music.apple.com" matched cert's "api.music.apple.com"
*  issuer: C=US; O=Apple Inc.; CN=Apple Public EV Server RSA CA 2 - G1
*  SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7fedf900b600)
> GET /v1/catalog/jp/search?term=B'z&types=artists HTTP/2
> Host: api.music.apple.com
> user-agent: curl/7.79.1
> accept: */*
> authorization: Bearer eyJhbGc_o_JFUzIoN_IsImtpZBI6Iks3XEs1XUI1oFE_LBJoeXB_o_JKVoQ_fQ.eyJpc3M_o_JaoXlENXc3MjZUI_w_aWFoIjoxNDM3MXc5MDM1LBJleHB_ojEooXMyoXgxMDA9.QgQS5gv75mSJMw5Hw5rIoUFUx1-IYyXIsau_Lkv6oMS-GKeLk_XuIWW6aRZ-Ex3-7KUAzMJIR5yHznvw5XIkkB
> 
< HTTP/2 200 
< server: 4.0.0
< content-type: application/json;charset=utf-8
< x-apple-jingle-correlation-key: JOSXR57OF2OG2ZRUJKOEOZVJRA
< x-apple-request-uuid: 4ba578f7-ee2e-9c6d-6634-4a9c4766a988
< b3: 4ba578f7ee2e9c6d66344a9c4766a988-0b03f71f5b294b1c
< x-b3-traceid: 4ba578f7ee2e9c6d66344a9c4766a988
< x-b3-spanid: 0b03f71f5b294b1c
< apple-seq: 0.0
< apple-tk: false
< apple-originating-system: MZStorePlatform
< x-apple-application-site: ST11
< x-apple-application-instance: 2534673
< x-responding-instance: MZStorePlatform:2534673:::
< apple-timing-app: 88 ms
< access-control-allow-origin: *
< strict-transport-security: max-age=31536000; includeSubDomains
< is-jetty: true
< x-daiquiri-instance: daiquiri:41896004:st53p00it-qujn15040101:7987:22RELEASE167:daiquiri-amp-store-l7shared-int-001-st
< x-daiquiri-instance: daiquiri:42282002:st53p00it-qujn13050102:7987:22RELEASE167:daiquiri-amp-store-l7shared-ext-001-st
< cache-control: public, no-transform, max-age=29
< date: Wed, 09 Nov 2022 00:22:40 GMT
< content-length: 8620
< x-cache: TCP_HIT from a23-55-45-84.deploy.akamaitechnologies.com (AkamaiGHost/10.10.1-44825277) (-)
< vary: Accept-Encoding
< vary: Accept-Encoding
< 
{"results":{"artists":{"href":"/v1/catalog/jp/search?limit=5&term=B%27z&types=artists","next":"/v1/catalog/jp/search?offset=5&term=B%27z&types=artists","data":[{"id":"74931253","type":"artists","href":"/v1/catalog/jp/artists/74931253","attributes":{"name":"B'z","genreNames":["ロック"],"artwork":{"width":2400,"height":2400,"url":"https://is5-ssl.mzstatic.com/image/thumb/Music122/v4/0c/88/58/0c885888-c769-81f8-8485-069cd9a362f1/pr_source.png/{w}x{h}bb.jpg","bgColor":"dcdfe6","textColor1":"000001","textColor2":"1b191e","textColor3":"2c2c2f","textColor4":"424046"},"url":"https://music.apple.com/jp/artist/bz/74931253"},"relationships":{"albums":{"href":"/v1/catalog/jp/artists/74931253/albums","next":"/v1/catalog/jp/artists/74931253/albums?offset=25","data":[{"id":"283000073","type":"albums","href":"/v1/catalog/jp/albums/283000073"},{"id":"292067907","type":"albums","href":"/v1/catalog/jp/albums/292067907"},{"id":"666625900","type":"albums","href":"/v1/catalog/jp/albums/666625900"},{"id":"75682683","type":"albums","href":"/v1/catalog/jp/albums/75682683"},{"id":"1561574089","type":"albums","href":"/v1/catalog/jp/albums/1561574089"},{"id":"74937562","type":"albums","href":"/v1/catalog/jp/albums/74937562"},{"id":"666634430","type":"albums","href":"/v1/catalog/jp/albums/666634430"},{"id":"75681798","type":"albums","href":"/v1/catalog/jp/albums/75681798"},{"id":"1605118558","type":"albums","href":"/v1/catalog/jp/albums/1605118558"},{"id":"75356318","type":"albums","href":"/v1/catalog/jp/albums/75356318"},{"id":"1466937136","type":"albums","href":"/v1/catalog/jp/albums/1466937136"},{"id":"74933581","type":"albums","href":"/v1/catalog/jp/albums/74933581"},{"id":"75682153","type":"albums","href":"/v1/catalog/jp/albums/75682153"},{"id":"347013256","type":"albums","href":"/v1/catalog/jp/albums/347013256"},{"id":"74935606","type":"albums","href":"/v1/catalog/jp/albums/74935606"},{"id":"75354662","type":"albums","href":"/v1/catalog/jp/albums/75354662"},{"id":"1325460835","type":"albums","href":"/v1/catalog/jp/albums/1325460835"},{"id":"454667912","type":"albums","href":"/v1/catalog/jp/albums/454667912"},{"id":"297710855","type":"albums","href":"/v1/catalog/jp/albums/297710855"},{"id":"1561701429","type":"albums","href":"/v1/catalog/jp/albums/1561701429"},{"id":"74944705","type":"albums","href":"/v1/catalog/jp/albums/74944705"},{"id":"1567851939","type":"albums","href":"/v1/catalog/jp/albums/1567851939"},{"id":"75361124","type":"albums","href":"/v1/catalog/jp/albums/75361124"},{"id":"1567852104","type":"albums","href":"/v1/catalog/jp/albums/1567852104"},{"id":"75357159","type":"albums","href":"/v1/catalog/jp/albums/75357159"}]}}},{"id":"1236215587","type":"artists","href":"/v1/catalog/jp/artists/1236215587","attributes":{"name":"BZ","genreNames":["ヒップホップ/ラップ"],"artwork":{"width":3000,"height":3000,"url":"https://is3-ssl.mzstatic.com/image/thumb/Music124/v4/ae/b6/fb/aeb6fb97-56ba-e8fd-083f-f8c21970a74f/artwork.jpg/{w}x{h}ac.jpg","bgColor":"0f1050","textColor1":"d6bcf7","textColor2":"9dafdf","textColor3":"ae99d5","textColor4":"818fc2"},"url":"https://music.apple.com/jp/artist/bz/1236215587"},"relationships":{"albums":{"href":"/v1/catalog/jp/artists/1236215587/albums","data":[{"id":"1612269170","type":"albums","href":"/v1/catalog/jp/albums/1612269170"},{"id":"1552528987","type":"albums","href":"/v1/catalog/jp/albums/1552528987"},{"id":"1170604377","type":"albums","href":"/v1/catalog/jp/albums/1170604377"},{"id":"1344358078","type":"albums","href":"/v1/catalog/jp/albums/1344358078"},{"id":"1501353949","type":"albums","href":"/v1/catalog/jp/albums/1501353949"},{"id":"1551034513","type":"albums","href":"/v1/catalog/jp/albums/1551034513"},{"id":"1502686217","type":"albums","href":"/v1/catalog/jp/albums/1502686217"},{"id":"1502573665","type":"albums","href":"/v1/catalog/jp/albums/1502573665"},{"id":"1544732805","type":"albums","href":"/v1/catalog/jp/albums/1544732805"},{"id":"1536654657","type":"albums","href":"/v1/catalog/jp/albums/1536654657"},{"id":"1549103433","type":"albums","href":"/v1/catalog/jp/albums/1549103433"},{"id":"1375096721","type":"albums","href":"/v1/catalog/jp/albums/1375096721"},{"id":"1561406752","type":"albums","href":"/v1/catalog/jp/albums/1561406752"},{"id":"1597875079","type":"albums","href":"/v1/catalog/jp/albums/1597875079"},{"id":"1566648690","type":"albums","href":"/v1/catalog/jp/albums/1566648690"},{"id":"1503527043","type":"albums","href":"/v1/catalog/jp/albums/1503527043"},{"id":"1448546746","type":"albums","href":"/v1/catalog/jp/albums/1448546746"},{"id":"1644747159","type":"albums","href":"/v1/catalog/jp/albums/1644747159"},{"id":"1629986398","type":"albums","href":"/v1/catalog/jp/albums/1629986398"},{"id":"1619147046","type":"albums","href":"/v1/catalog/jp/albums/1619147046"},{"id":"1606159561","type":"albums","href":"/v1/catalog/jp/albums/1606159561"},{"id":"1582431314","type":"albums","href":"/v1/catalog/jp/albums/1582431314"}]}}},{"id":"1465740891","type":"artists","href":"/v1/catalog/jp/artists/1465740891","attributes":{"name":"BZ","genreNames":["エレクトロニック"],"artwork":{"width":500,"height":500,"url":"https://is3-ssl.mzstatic.com/image/thumb/Features125/v4/9e/da/50/9eda50fb-495d-62dd-473e-7e5ad83209f7/pr_source.png/{w}x{h}bb.jpg","bgColor":"1a1615","textColor1":"f6c069","textColor2":"d8a971","textColor3":"ca9e58","textColor4":"b28c5e"},"url":"https://music.apple.com/jp/artist/bz/1465740891"},"relationships":{"albums":{"href":"/v1/catalog/jp/artists/1465740891/albums","data":[{"id":"838262440","type":"albums","href":"/v1/catalog/jp/albums/838262440"},{"id":"997882538","type":"albums","href":"/v1/catalog/jp/albums/997882538"},{"id":"964660751","type":"albums","href":"/v1/catalog/jp/albums/964660751"},{"id":"1212786159","type":"albums","href":"/v1/catalog/jp/albums/1212786159"},{"id":"1579770371","type":"albums","href":"/v1/catalog/jp/albums/1579770371"}]}}},{"id":"1585689464","type":"artists","href":"/v1/catalog/jp/artists/1585689464","attributes":{"name":"BZ","genreNames":["エレクトロニック"],"artwork":{"width":4000,"height":4000,"url":"https://is5-ssl.mzstatic.com/image/thumb/Music122/v4/ac/09/ab/ac09ab8c-1707-c6aa-a45e-9074649456f0/5059722847474_cover.jpg/{w}x{h}ac.jpg","bgColor":"03242f","textColor1":"d0cecc","textColor2":"21b9d9","textColor3":"a7acac","textColor4":"1b9bb7"},"url":"https://music.apple.com/jp/artist/bz/1585689464"},"relationships":{"albums":{"href":"/v1/catalog/jp/artists/1585689464/albums","data":[{"id":"776208953","type":"albums","href":"/v1/catalog/jp/albums/776208953"},{"id":"1612158034","type":"albums","href":"/v1/catalog/jp/albums/1612158034"},{"id":"1571657950","type":"albums","href":"/v1/catalog/jp/albums/1571657950"},{"id":"1581841967","type":"albums","href":"/v1/catalog/jp/albums/1581841967"},{"id":"1577141561","type":"albums","href":"/v1/catalog/jp/albums/1577141561"},{"id":"1577141651","type":"albums","href":"/v1/catalog/jp/albums/1577141651"},{"id":"1583900522","type":"albums","href":"/v1/catalog/jp/albums/1583900522"},{"id":"1620727001","type":"albums","href":"/v1/catalog/jp/albums/1620727001"},{"id":"1584610904","type":"albums","href":"/v1/catalog/jp/albums/1584610904"}]}}},{"id":"303385174","type":"artists","href":"/v1/catalog/jp/artists/303385174","attributes":{"name":"BZ","genreNames":["ヒップホップ/ラップ"],"artwork":{"width":996,"height":996,"url":"https://is1-ssl.mzstatic.com/image/thumb/Music112/v4/81/ef/b0/81efb079-e993-f42a-cfe1-6ece22673a2f/pr_source.png/{w}x{h}bb.jpg","bgColor":"1f1c2d","textColor1":"c7cea4","textColor2":"d0ba8c","textColor3":"a6ab8c","textColor4":"ad9a79"},"url":"https://music.apple.com/jp/artist/bz/303385174"},"relationships":{"albums":{"href":"/v1/catalog/jp/artists/303385174/albums","data":[{"id":"1447921556","type":"albums","href":"/v1/catalog/jp/albums/1447921556"},{"id":"1637062769","type":"albums","href":"/v1/catalog/jp/albums/1637062769"},{"id":"1517197555","type":"albums","href":"/v1/catalog/jp/albums/1517197555"},{"id":"1614079632","type":"albums","href":"/v1/catalog/jp/albums/1614079632"},{"id":"1558826365","type":"albums","href":"/v1/catalog/jp/albums/1558826365"},{"id":"1609298956","type":"albums* Connection #0 to host api.music.apple.com left intact
","href":"/v1/catalog/jp/albums/1609298956"},{"id":"1584989196","type":"albums","href":"/v1/catalog/jp/albums/1584989196"},{"id":"1522129749","type":"albums","href":"/v1/catalog/jp/albums/1522129749"},{"id":"1648328595","type":"albums","href":"/v1/catalog/jp/albums/1648328595"},{"id":"1635988163","type":"albums","href":"/v1/catalog/jp/albums/1635988163"}]}}}]}},"meta":{"results":{"order":["artists"],"rawOrder":["artists"]}}}%                                                                                                                      % 

見づらいので形を整えたものが下記です。

{
    "results": {
        "artists": {
            "href": "/v1/catalog/jp/search?limit=5&term=B%27z&types=artists",
            "next": "/v1/catalog/jp/search?offset=5&term=B%27z&types=artists",
            "data": [
                {
                    "id": "74931253",
                    "type": "artists",
                    "href": "/v1/catalog/jp/artists/74931253",
                    "attributes": {
                        "name": "B'z",
                        "genreNames": [
                            "ロック"
                        ],
                        "artwork": {
                            "width": 2400,
                            "height": 2400,
                            "url": "https://is5-ssl.mzstatic.com/image/thumb/Music122/v4/0c/88/58/0c885888-c769-81f8-8485-069cd9a362f1/pr_source.png/{w}x{h}bb.jpg",
                            "bgColor": "dcdfe6",
                            "textColor1": "000001",
                            "textColor2": "1b191e",
                            "textColor3": "2c2c2f",
                            "textColor4": "424046"
                        },
                        "url": "https://music.apple.com/jp/artist/bz/74931253"
                    },
                    "relationships": {
                        "albums": {
                            "href": "/v1/catalog/jp/artists/74931253/albums",
                            "next": "/v1/catalog/jp/artists/74931253/albums?offset=25",
                            "data": [
                                {
                                    "id": "283000073",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/283000073"
                                },
                                {
                                    "id": "292067907",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/292067907"
                                },
                                {
                                    "id": "666625900",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/666625900"
                                },
                                {
                                    "id": "75682683",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/75682683"
                                },
                                {
                                    "id": "1561574089",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1561574089"
                                },
                                {
                                    "id": "74937562",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/74937562"
                                },
                                {
                                    "id": "666634430",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/666634430"
                                },
                                {
                                    "id": "75681798",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/75681798"
                                },
                                {
                                    "id": "1605118558",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1605118558"
                                },
                                {
                                    "id": "75356318",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/75356318"
                                },
                                {
                                    "id": "1466937136",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1466937136"
                                },
                                {
                                    "id": "74933581",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/74933581"
                                },
                                {
                                    "id": "75682153",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/75682153"
                                },
                                {
                                    "id": "347013256",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/347013256"
                                },
                                {
                                    "id": "74935606",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/74935606"
                                },
                                {
                                    "id": "75354662",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/75354662"
                                },
                                {
                                    "id": "1325460835",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1325460835"
                                },
                                {
                                    "id": "454667912",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/454667912"
                                },
                                {
                                    "id": "297710855",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/297710855"
                                },
                                {
                                    "id": "1561701429",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1561701429"
                                },
                                {
                                    "id": "74944705",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/74944705"
                                },
                                {
                                    "id": "1567851939",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1567851939"
                                },
                                {
                                    "id": "75361124",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/75361124"
                                },
                                {
                                    "id": "1567852104",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1567852104"
                                },
                                {
                                    "id": "75357159",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/75357159"
                                }
                            ]
                        }
                    }
                },
                {
                    "id": "1236215587",
                    "type": "artists",
                    "href": "/v1/catalog/jp/artists/1236215587",
                    "attributes": {
                        "name": "BZ",
                        "genreNames": [
                            "ヒップホップ/ラップ"
                        ],
                        "artwork": {
                            "width": 3000,
                            "height": 3000,
                            "url": "https://is3-ssl.mzstatic.com/image/thumb/Music124/v4/ae/b6/fb/aeb6fb97-56ba-e8fd-083f-f8c21970a74f/artwork.jpg/{w}x{h}ac.jpg",
                            "bgColor": "0f1050",
                            "textColor1": "d6bcf7",
                            "textColor2": "9dafdf",
                            "textColor3": "ae99d5",
                            "textColor4": "818fc2"
                        },
                        "url": "https://music.apple.com/jp/artist/bz/1236215587"
                    },
                    "relationships": {
                        "albums": {
                            "href": "/v1/catalog/jp/artists/1236215587/albums",
                            "data": [
                                {
                                    "id": "1612269170",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1612269170"
                                },
                                {
                                    "id": "1552528987",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1552528987"
                                },
                                {
                                    "id": "1170604377",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1170604377"
                                },
                                {
                                    "id": "1344358078",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1344358078"
                                },
                                {
                                    "id": "1501353949",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1501353949"
                                },
                                {
                                    "id": "1551034513",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1551034513"
                                },
                                {
                                    "id": "1502686217",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1502686217"
                                },
                                {
                                    "id": "1502573665",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1502573665"
                                },
                                {
                                    "id": "1544732805",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1544732805"
                                },
                                {
                                    "id": "1536654657",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1536654657"
                                },
                                {
                                    "id": "1549103433",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1549103433"
                                },
                                {
                                    "id": "1375096721",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1375096721"
                                },
                                {
                                    "id": "1561406752",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1561406752"
                                },
                                {
                                    "id": "1597875079",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1597875079"
                                },
                                {
                                    "id": "1566648690",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1566648690"
                                },
                                {
                                    "id": "1503527043",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1503527043"
                                },
                                {
                                    "id": "1448546746",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1448546746"
                                },
                                {
                                    "id": "1644747159",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1644747159"
                                },
                                {
                                    "id": "1629986398",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1629986398"
                                },
                                {
                                    "id": "1619147046",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1619147046"
                                },
                                {
                                    "id": "1606159561",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1606159561"
                                },
                                {
                                    "id": "1582431314",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1582431314"
                                }
                            ]
                        }
                    }
                },
                {
                    "id": "1465740891",
                    "type": "artists",
                    "href": "/v1/catalog/jp/artists/1465740891",
                    "attributes": {
                        "name": "BZ",
                        "genreNames": [
                            "エレクトロニック"
                        ],
                        "artwork": {
                            "width": 500,
                            "height": 500,
                            "url": "https://is3-ssl.mzstatic.com/image/thumb/Features125/v4/9e/da/50/9eda50fb-495d-62dd-473e-7e5ad83209f7/pr_source.png/{w}x{h}bb.jpg",
                            "bgColor": "1a1615",
                            "textColor1": "f6c069",
                            "textColor2": "d8a971",
                            "textColor3": "ca9e58",
                            "textColor4": "b28c5e"
                        },
                        "url": "https://music.apple.com/jp/artist/bz/1465740891"
                    },
                    "relationships": {
                        "albums": {
                            "href": "/v1/catalog/jp/artists/1465740891/albums",
                            "data": [
                                {
                                    "id": "838262440",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/838262440"
                                },
                                {
                                    "id": "997882538",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/997882538"
                                },
                                {
                                    "id": "964660751",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/964660751"
                                },
                                {
                                    "id": "1212786159",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1212786159"
                                },
                                {
                                    "id": "1579770371",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1579770371"
                                }
                            ]
                        }
                    }
                },
                {
                    "id": "1585689464",
                    "type": "artists",
                    "href": "/v1/catalog/jp/artists/1585689464",
                    "attributes": {
                        "name": "BZ",
                        "genreNames": [
                            "エレクトロニック"
                        ],
                        "artwork": {
                            "width": 4000,
                            "height": 4000,
                            "url": "https://is5-ssl.mzstatic.com/image/thumb/Music122/v4/ac/09/ab/ac09ab8c-1707-c6aa-a45e-9074649456f0/5059722847474_cover.jpg/{w}x{h}ac.jpg",
                            "bgColor": "03242f",
                            "textColor1": "d0cecc",
                            "textColor2": "21b9d9",
                            "textColor3": "a7acac",
                            "textColor4": "1b9bb7"
                        },
                        "url": "https://music.apple.com/jp/artist/bz/1585689464"
                    },
                    "relationships": {
                        "albums": {
                            "href": "/v1/catalog/jp/artists/1585689464/albums",
                            "data": [
                                {
                                    "id": "776208953",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/776208953"
                                },
                                {
                                    "id": "1612158034",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1612158034"
                                },
                                {
                                    "id": "1571657950",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1571657950"
                                },
                                {
                                    "id": "1581841967",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1581841967"
                                },
                                {
                                    "id": "1577141561",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1577141561"
                                },
                                {
                                    "id": "1577141651",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1577141651"
                                },
                                {
                                    "id": "1583900522",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1583900522"
                                },
                                {
                                    "id": "1620727001",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1620727001"
                                },
                                {
                                    "id": "1584610904",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1584610904"
                                }
                            ]
                        }
                    }
                },
                {
                    "id": "303385174",
                    "type": "artists",
                    "href": "/v1/catalog/jp/artists/303385174",
                    "attributes": {
                        "name": "BZ",
                        "genreNames": [
                            "ヒップホップ/ラップ"
                        ],
                        "artwork": {
                            "width": 996,
                            "height": 996,
                            "url": "https://is1-ssl.mzstatic.com/image/thumb/Music112/v4/81/ef/b0/81efb079-e993-f42a-cfe1-6ece22673a2f/pr_source.png/{w}x{h}bb.jpg",
                            "bgColor": "1f1c2d",
                            "textColor1": "c7cea4",
                            "textColor2": "d0ba8c",
                            "textColor3": "a6ab8c",
                            "textColor4": "ad9a79"
                        },
                        "url": "https://music.apple.com/jp/artist/bz/303385174"
                    },
                    "relationships": {
                        "albums": {
                            "href": "/v1/catalog/jp/artists/303385174/albums",
                            "data": [
                                {
                                    "id": "1447921556",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1447921556"
                                },
                                {
                                    "id": "1637062769",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1637062769"
                                },
                                {
                                    "id": "1517197555",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1517197555"
                                },
                                {
                                    "id": "1614079632",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1614079632"
                                },
                                {
                                    "id": "1558826365",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1558826365"
                                },
                                {
                                    "id": "1609298956",
                                    "type": "albums* Connection #0 to host api.music.apple.com left intact",
                                    "href": "/v1/catalog/jp/albums/1609298956"
                                },
                                {
                                    "id": "1584989196",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1584989196"
                                },
                                {
                                    "id": "1522129749",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1522129749"
                                },
                                {
                                    "id": "1648328595",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1648328595"
                                },
                                {
                                    "id": "1635988163",
                                    "type": "albums",
                                    "href": "/v1/catalog/jp/albums/1635988163"
                                }
                            ]
                        }
                    }
                }
            ]
        }
    },
    "meta": {
        "results": {
            "order": [
                "artists"
            ],
            "rawOrder": [
                "artists"
            ]
        }
    }
}

とりあえず無事認証済みの開発者としてアクセスできました。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です