Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

440
Visualizações
Verifying in external Django REST API if a Wordpress user is a paid subscriber or not

I have been working on a program in python that I want to make available to paid subscribers via REST. I'm currently thinking of having the frontend made in Wordpress and then host the backend somewhere else.

In wordpress there are a bunch of plugins to handle paid subscribers and so on and everything seems great but my concern is how do I verify this on the backend that is hosted somewhere else? If I use Django, is there any way I can make some kind of call to the Wordpress server(?) and verify that the user that is trying to fetch items are an paid subscriber?

I made a Diagram to kind of show what I mean. Basically B should only answer back with items if the caller A is a paid subscriber.

I've read that it is possible to generate an API key that will be needed in order to fetch data from the API, I've also read ways of hiding this call from the frontend to the backend from the user by using some kind of relay on wordpress. Might be wrong here.

Is there any preferred way of doing this? Is Django REST & Wordpress suitable options to do this?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

In programming almost anything is possible. However, since wordpress is built in php I would not say that it would be possible to work directly with it. But, (MAYBE) you can connect the wordpress database to django for READ only and create an api.

How I would do it if I had this task:

  1. Connect Django to an existing db (your wordpress db):

    • Django itself teaches you how to connect with a legacy database from its documentation.
     Django comes with a utility called inspectdb that can create models by 
     introspecting an existing database. You can view the output by running 
     this command:
    
    $ python manage.py inspectdb
    Save this as a file by using standard Unix output redirection:
    
    $ python manage.py inspectdb > models.py
    
    **This feature is meant as a shortcut, not as definitive model generation.**
    
  2. Since you created the models you can create your endpoints:

    • Create you serializers and viewsets from the models that was auto-generated by django from your wordpress db.
    • Display the data you need such as the user data you need to fetch ex:paid_subscriber = True or paid_subscriber = 1. Certainly it will be there.

I think the only issue you will have is to connect with the wordpress database. After you have done this in django nothing can stop you to create endpoints with django-rest-framework displaying the data it has.

over 4 years ago · Santiago Trujillo Relatório

0

You can do that using the Django REST framework(DRF) which is used for such purpose for making the rest API's.

As per your query i would suggest you to the DRF to read the data from wordpress database and perform the validation on top of it.

Here are some links that you can use for reference :-

https://pythonrepo.com/repo/istrategylabs-django-wordpress-python-third-party-apis-wrappers https://www.ianlewis.org/en/administer-wordpress-django-admin

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda