Rest 对于可以采用2种不同格式的API,JSON格式输入中字段的名称相同或不同

Rest 对于可以采用2种不同格式的API,JSON格式输入中字段的名称相同或不同,rest,Rest,我有一个API,它接受如下输入 { 'fileContent': 'base64-encoded file here' } 我还想接受一个包含文件内容的URI 我是否应该使用相同的fileContent字段名,例如: { 'fileContent': 'https://example.com/filename' } { 'fileUri': 'https://example.com/filename' } 然后解码base64或在我的代码中下载URI,或使用不同的字段名,例如: { 'fi

我有一个API,它接受如下输入

{ 'fileContent': 'base64-encoded file here' }
我还想接受一个包含文件内容的URI

我是否应该使用相同的fileContent字段名,例如:

{ 'fileContent': 'https://example.com/filename' }
{ 'fileUri': 'https://example.com/filename' }
然后解码base64或在我的代码中下载URI,或使用不同的字段名,例如:

{ 'fileContent': 'https://example.com/filename' }
{ 'fileUri': 'https://example.com/filename' }

使用不同的字段名更灵活,并且在检查字段内容时,代码中的错误更少