You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

iTunes搜索接口使用越南语(vi_VN)参数报错,求助解决方案

Troubleshooting iTunes Store Search API Error with Vietnamese Locale

Let’s break down the issues you’re facing and walk through actionable fixes:

First, let’s recap the key details from your problem:

  • Your failing request: https://itunes.apple.com/search?term=Ok&limit=200&entity=&lang=vi_VN&country=VN
  • Switching to lang=ja_JP&country=JP works, but you need Vietnamese locale support.

Common Causes & Fixes

1. Fix URL Entity Escaping & Empty entity Parameter

Your request has two immediate red flags that could be causing the error:

  • The & in the URL is an HTML entity escape—actual HTTP requests require plain & as parameter separators. Using & will make the API misparse parameters (for example, it’ll read lang=vi_VN&country=VN as a single invalid lang parameter value).
  • You’re passing an empty entity parameter. The iTunes Search API requires this to specify the media type you’re searching for (e.g., song, album, movie). An empty entity might work for some locales but fail for others like Vietnamese.

Start by correcting these with a simplified test URL:

https://itunes.apple.com/search?term=Ok&limit=200&entity=song&lang=vi_VN&country=VN

2. Adjust the Language Parameter Format

While vi_VN is a standard locale code, the iTunes API sometimes accepts shorter language codes without the region suffix for certain markets. Try replacing lang=vi_VN with just lang=vi while keeping country=VN:

https://itunes.apple.com/search?term=Ok&limit=200&entity=song&lang=vi&country=VN

3. Let the API Auto-Detect Language (Omit lang)

If specifying the language directly still fails, try omitting the lang parameter entirely. The API will usually auto-select the appropriate language based on the country=VN parameter:

https://itunes.apple.com/search?term=Ok&limit=200&entity=song&country=VN

4. Inspect the Error Response

If none of the above works, look closely at the JSON error response the API returns. It will typically include an errorMessage field that gives specific details (e.g., invalid parameter value, unsupported locale for the requested media type). This can pinpoint exactly what’s breaking the request.

5. Verify Official Locale Support

Even if third-party sources note Vietnamese support, cross-check the official iTunes Search API documentation for the full list of supported locales. Sometimes certain language-region combinations have limited support for specific media types.


内容的提问来源于stack exchange,提问作者oaranger

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:53:46