我正在設計一個REST API(第一次),我對如何在POST請求中處理多語言有很多疑問。REST API,多語言設計
示例是廣告提交。
- 我的選項1:
參數(...,...,title_en,title_pt,description_en,description_pt)
POST請求(名稱,值)
some_field1, "some text1"
some_field2, "some text2"
title_en, "Some Title"
title_pt, "Algum Titulo"
description_en, "Some Description"
description_pt, "Alguma Descrição"
- 我的選項2:
參數(...,...,標題,描述)
POST請求(名稱,值)
some_field1, "some text1"
some_field2, "some text2"
titles, [{"en":"Some Title","pt":"Algum Titulo"}]
descriptions, [{"en":"Some Description","pt":"Alguma Descrição"}]
我的問題:什麼是做一個REST的正確方法API?
最好的問候, 安德烈
什麼是資源的媒體類型爲發佈到API? –