Are there any higher level class to build a REST client?



  • I recently got the request to change a piece of code that is performing SQL insertions to a piece of "2.0" code that push JSON/xml to a REST server instead.
    I was told that I live in the past and no one messes up with database nowadays :)

    Are you guys aware of any library that could do that? Or should I start from scratch with QNetwork classes?
    Thanks in advance for your help!


  • Lifetime Qt Champion

    Hi,

    Well, it's one way to shield your database from external connection and it also allows you to completely change your backend if needed without having to touch your application.

    Anyway, do you mean the client or the backend part ?



  • Yes I do agree this is a good way to separate the data as they are generated by my program and their copy handled in the database.
    As mentioned in the title, I'm looking for help regarding the client, not the backend.
    FWII I just need to implement a client that POST the data array to the backend (=server) am I right?


  • Lifetime Qt Champion

    I managed to miss client after REST...

    POST or PUT depending on the semantic behind the end point you are going to contact. i.e. post should create a new entry (e.g. user, note, whatever it is you handle) and PUT update an existing one (e.g. the first name of a user etc.).

    QNetworkAccessManager should be enough for your needs from your description.

    You can also take a look at the engin.io module for inspiration but currently it might be over engineering for what you want to do.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.