Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api #705

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Api #705

wants to merge 12 commits into from

Conversation

pilot114
Copy link

add json rpc api for mobile clients

die();
}

function requireFields($data, $fields)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

код стайл: названия функций -- в_такой_нотации
фигурная скобка должна быть на той же строчке

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

if ($reg_status == 1) {
return 'User created';
}
throw new \Exception("User don't create: invalid data. Status:$reg_status", 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration failed due to invalid data

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

@@ -8,6 +8,13 @@
return;
}

// crutch for api
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А можно пояснить, зачем это на index.php?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

можно. Хочется соответствовать стандартам написания апи и завязать его на url вида /v1.0 (а не /api.php или /?page=api). Например, на facebook так. В идеале, конечно, хотелось бы чтобы у всего сайта была единая точка входа вместо кучи скриптов, best practices типа =)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А, например, на Википедии так: https://ru.wikipedia.org/api/rest_v1 :)

@grandsbor
Copy link
Member

Смержил в текущем виде в веточку и выкатил в тестинг. opencorpora.org:8080, база там продакшен

@uniconstructor
Copy link

Если вы работаете с Symfony, основной язык проекта PHP и вам нужен REST API то рекомендую глянуть насколько вам подойдет API Platform: https://api-platform.com/

Демо можно посмотреть тут: https://demo.api-platform.com
(у них первый класс в API как раз тоже называется Book как документы у вас в базе)

Все возможности их API описаны здесь: https://api-platform.com/docs/core#features

В основе проекта 4 версия symfony.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants