📜 ⬆️ ⬇️

Writing a web API to your system

Good afternoon,% username%!
Over the past year, I ran into several tasks of writing the SOAP / REST API to various services and brought out a more or less convenient model for myself. I do not pretend to be a fundamental research, I just want to share the experience of attacking a rake.

First, the general requirements for the default API:


API (PHP/Perl/Python et), UI (JS). , .
JSON. XML, API JavaScript — ?

:
cmd=" "&data="JSON "&sig=" , "
:
cmd — , . , auth, profile, edit, view — . JSON, JSON .
data — JSON.
sig — , . , - : md5(cmd+secret+data), secret — , ( , ), .
- (AJAX-JavaScript) — secret cookie .

:
{
status: "ok error - "
response: " "
error: " 0 "
}

, .
. :
  1. , , cmd
  2. — (sig) — ,
  3. ,

, , , . , , .

, :
  1. Manager — ,
  2. Module — . , , , , Registry, , ,
  3. Registry — , — Manager.
  4. Response — , , . (JSON )
  5. -

, — Registry Response.

, :

, .

API , . , .

UPD: REST SOAP API. , . REST — , .

')

Source: https://habr.com/ru/post/108973/


All Articles