Wrong practice of combining REST and RPC together?

I am new to REST web services and am very used to RPC . I know the benefits of REST by reading a few posts, for example.

I am developing a server in django using the django-rest-framework.

Although you have this question (or questions):

I have this model:

class Poll(models.Model):
    questionString = models.CharField(max_length=500, blank=True)
    timeToAnswer = models.IntegerField(default=30)
    startDate = models.DateTimeField(null=True, db_column='startDate', blank=True)
    token = models.CharField(max_length=20, blank=True, unique=True)

class PollAggregator(models.Model):

    name = models.CharField(max_length=135)
    description = models.CharField(max_length=500, blank=True)
    votersToken = models.CharField(max_length=20, null=True, blank=True)

class PollPollAggregatorRel(models.Model):
    pollAggregator = models.ForeignKey(PollAggregator, null=True, db_column='pollAggregatorId', blank=True)
    poll = models.ForeignKey(Poll, null=True, db_column='pollId', blank=True)

So, I can have one survey, or I can have a bunch of surveys aggregated in the survey aggregator (i.e. premises).

, : pollList, pollDetail, pollAggregatorList, pollAggregatorDetail. PollPollAgregatorRel. , PollPollAgregatorRelList PollPollAgregatorRelDetail , , , . , REST, :

  • , PollPollAgregator () get pollId
  • , , pollAggregator
  • , PollPollAgregator

- ?

RPC, -, - :

  • pollAggregator get_or_create PollPollAggregatorRel. PollPollAggregatorRel.

, RPC, REST, 2 . RPC .

: REST RPC API?

+4
1

Q1: , POST REST, , , . , , "RPC".

, , "REST" (: "", "" ) . , .

REST! ​​= CRUD.

REST , , , . , , , . . REST URI , , " " ( " " ) .

, , , :

  • , ( ) ( HTTP Link)

  • , (, GET , POST )

  • , URI , " ". GET, PUT, DELETE , . , POST.

  • , ( ? - ). POST , ULLLLLLL, ( ?) . GET .

  • , URI , .

PollPollAggregatorRel () , , REST API. , , API. REST.

, " ", REST. REST " ", , , , . , , , , .

Q2: REST RPC API. ( REST RPC API-.)

, REST API, RPC , REST .

+4

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


All Articles