donglue1886 2016-01-25 16:43
浏览 134

创建Restful API在响应之前应该放置哪种标头?

I am not finding a whole lot of information on this, maybe I am just searching wrong, who knows.. What I want to know or try to figure out is what kind of headers should I output for API responses example

header('Content-Type: application/json');

Is something I would put out for the type of data, but are there others for time, expiration, or anything else for that matter that I should concern myself with?

Ultimately I am attempting to make an API for an app I want to develope so I am trying to figure out early what will be cross platform compliant and what needs are so I can try to build them into my idea of what would be part of standard dev

  • 写回答

2条回答 默认 最新

  • dongzong2017 2016-01-25 18:40
    关注

    One good thing that I include in my response headers is a correlation id for the request that was sent. This allows consumers of your API to correlate a question or a potential bug with a request and allow you to look up information pertaining to that request.

    This, of course, requires you to log information associated to the correlation id but it has proven to be very useful for me.

    评论

报告相同问题?

悬赏问题

  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突