DUMP-2013 Serverside - Типичные ошибки проектирования API - Кирпичников Алексей

1,704 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,704
On SlideShare
0
From Embeds
0
Number of Embeds
1,324
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

DUMP-2013 Serverside - Типичные ошибки проектирования API - Кирпичников Алексей

  1. 1. ТрудностипроектированияAPI
  2. 2. api.sometaxi.ruПартнеры/request ➞/status/cancel ➞Приложения➞ /order➞ /status➞ /feedback➞
  3. 3. client-api.sometaxi.ruПартнеры/request ➞/status/cancel ➞Приложения➞ /order➞ /status➞ /feedbackpartner-api.sometaxi.ru➞
  4. 4. client-api.sometaxi.ruПартнеры/2.1/request ➞/2.1/status/2.1/cancel ➞Приложения➞ /1.0/order➞ /1.0/status➞ /1.0/feedbackpartner-api.sometaxi.ru➞
  5. 5. 3.2.5
  6. 6. .../3.2/...
  7. 7. client-api.sometaxi.ru/2.1/request ➞/2.1/status/2.1/cancel ➞➞ /1.0/order➞ /1.0/status➞ /1.0/feedbackpartner-api.sometaxi.ru➞
  8. 8. client-api.sometaxi.ru/2.1/request ➞/2.1/status/2.1/cancel ➞➞ /1.0/order➞ /1.0/status➞ /1.0/feedbackpartner-api.sometaxi.ru➞XML
  9. 9. <?xml version="1.0" encoding="utf-8"><Order><From><Address>Хохрякова, 10</Address><DateTime>03.06.2013 12:00</DateTime></From>...</Order>XML
  10. 10. <?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"><soap:Body xmlns:t="http://client-api.sometaxi.ru/xmlns"><t:Order><t:From><t:Address>Хохрякова, 10</t:Address><t:DateTime>2013-06-03T12:00+0600</t:DateTime></t:From>...</t:Order></soap:Body></soap:Envelope>XML
  11. 11. <?xml version="1.0"?><!DOCTYPE lolz [<!ENTITY lol "lol"><!ENTITY lol1 "&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;"><!ENTITY lol2 "&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;"><!ENTITY lol3 "&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;"><!ENTITY lol4 "&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;"><!ENTITY lol5 "&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;"><!ENTITY lol6 "&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;"><!ENTITY lol7 "&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;"><!ENTITY lol8 "&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;"><!ENTITY lol9 "&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;">]><lolz>&lol9;</lolz>XML
  12. 12. {"from": {"address": "Хохрякова, 10","datetime": "2013-06-03T12:00+0600"},...}JSON
  13. 13. client-api.sometaxi.ru/2.1/request ➞/2.1/status/2.1/cancel ➞➞ /1.0/order➞ /1.0/status➞ /1.0/feedbackpartner-api.sometaxi.ru➞XMLJSON
  14. 14. /2.1/request ➞/2.1/status:driving/2.1/cancel ➞/2.1/status:cancelledpartner-api.sometaxi.ru➞200 OK200 OK200 OK200 OK➞
  15. 15. /2.1/request ➞/2.1/status:driving/2.1/cancel ➞/2.1/status:waitingpartner-api.sometaxi.ru➞200 OK200 OKrequest timeout200 OK?➞
  16. 16. /2.1/request ➞/2.1/status:driving/2.1/cancel ➞/2.1/cancel ➞/2.1/cancel ➞.../2.1/status:waiting/2.1/status:cancelledpartner-api.sometaxi.ru➞200 OK200 OKrequest timeoutrequest timeoutrequest timeout...410 Gone!200 OK :)➞➞
  17. 17. {"from": {"city": "Москва","address": "Хохрякова, 10","datetime": "2013-06-03T12:00+0600"},"user": {"name": "Алексей","phone": "+79001112233"},...}/1.0/order
  18. 18. {"from": {"city": "00001","address": "Хохрякова, 10","datetime": "2013-06-03T12:00+0600"},"user": {"phone": "+79001112233"},...}/1.0/order
  19. 19. {"from": {"city": "00001","address": "Хохрякова, 10","datetime": "2013-06-03T12:00+0600"},"user": {"name": "","phone": "+79001112233"},...}/1.0/order
  20. 20. {"from": {"city": "00001","address": "Хохрякова, 10","datetime": "2013-06-03T12:00+0600"},"user": {"name": " ","phone": "+79001112233"},...}/1.0/order
  21. 21. Пользователь — не друг.Умейте его банить.
  22. 22. МелкимшрифтомИспользуйте возможности протоколаgzipkeepaliveПишите примеры использованияпример значения поляпример целого запросапример целого приложения на популярном языкеВедите подробные логи•––•–––•
  23. 23. Старший разработчикЯндекс.Таксиalexkir@yandex-team.rubeevee_ruСпасибоАлексей Кирпичников

×