Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt and Octopart API
Forum Updated to NodeBB v4.3 + New Features

Qt and Octopart API

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 4 Posters 5.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jemazter
    wrote on last edited by
    #1

    Hello everyone.

    Currently i'm trying to develop a software that will use the Octopart API (https://octopart.com/api/docs/v3/overview#search), i need to make request s to the API server and get the JSON data from it. Unfortunately i dont know where to start with that. I already read some tutorials about http requests but didn't understand how to use that. Can someone point me a god tutorial or book about it?

    Thanks in advance.

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      QNetworkAccessmanager should be enough to deal with http requests and replays. for JSON see http://doc.qt.io/qt-5/json.html

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      1
      • J Offline
        J Offline
        jemazter
        wrote on last edited by
        #3

        So, i used the following code, just to see if i get a response.

        QNetworkAccessManager *manager = new QNetworkAccessManager(this);
        connect(manager, SIGNAL(finished(QNetworkReply*)),
                        this, SLOT(replyFinished(QNetworkReply*)));
        manager->get(QNetworkRequest(QUrl("https://octopart.com/api/v3/parts/103cdb613d20cffb?apikey=EXAMPLE_KEY")));
        

        But i get the following errors:

        qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_client_method
        qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_client_method
        qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_server_method
        qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_server_method
        qt.network.ssl: QSslSocket: cannot resolve SSL_select_next_proto
        qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb
        qt.network.ssl: QSslSocket: cannot resolve SSL_get0_next_proto_negotiated
        qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated

        Does anyone knows the solution for this?

        Thanks.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi and welcome to devnet,

          What OS are you on ?

          I'm guessing Windows. If that's the case, did you install OpenSSL on your machine ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by
            #5

            also apikey=EXAMPLE_KEY probably needs to be replaced with a valid key

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            1 Reply Last reply
            1
            • J Offline
              J Offline
              jemazter
              wrote on last edited by
              #6

              Hello again.

              I installed OpenSSL but i keep getting the same errors. The URL i was using was wrong, but after correction, the errors continue.

              The API Key Example can be used for a specific search, so i dont think that is the problem.

              raven-worxR 1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                What OS are you running ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  jemazter
                  wrote on last edited by
                  #8

                  Hi.

                  Currently i'm running on Windows 10.

                  1 Reply Last reply
                  0
                  • J jemazter

                    Hello again.

                    I installed OpenSSL but i keep getting the same errors. The URL i was using was wrong, but after correction, the errors continue.

                    The API Key Example can be used for a specific search, so i dont think that is the problem.

                    raven-worxR Offline
                    raven-worxR Offline
                    raven-worx
                    Moderators
                    wrote on last edited by
                    #9

                    @jemazter said in Qt and Octopart API:

                    I installed OpenSSL but i keep getting the same errors

                    Following is important here:

                    1. what version of OpenSSL?
                    2. is the path to the OpenSSL DLLs in the PATH env variable, so the application can find and load it? Alternatively you can copy the 2 DLLs right next to your application exe (or to be more specific here: into the current working directory, which might not necessarily be the directory the exe is in when starting the application from QtCreator for example)

                    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                    If you have a question please use the forum so others can benefit from the solution in the future

                    J 1 Reply Last reply
                    1
                    • raven-worxR raven-worx

                      @jemazter said in Qt and Octopart API:

                      I installed OpenSSL but i keep getting the same errors

                      Following is important here:

                      1. what version of OpenSSL?
                      2. is the path to the OpenSSL DLLs in the PATH env variable, so the application can find and load it? Alternatively you can copy the 2 DLLs right next to your application exe (or to be more specific here: into the current working directory, which might not necessarily be the directory the exe is in when starting the application from QtCreator for example)
                      J Offline
                      J Offline
                      jemazter
                      wrote on last edited by
                      #10

                      @raven-worx said in Qt and Octopart API:

                      @jemazter said in Qt and Octopart API:

                      I installed OpenSSL but i keep getting the same errors

                      Following is important here:

                      1. what version of OpenSSL?
                      2. is the path to the OpenSSL DLLs in the PATH env variable, so the application can find and load it? Alternatively you can copy the 2 DLLs right next to your application exe (or to be more specific here: into the current working directory, which might not necessarily be the directory the exe is in when starting the application from QtCreator for example)

                      Hi.

                      I installed v1.1.0c. I installed it using an executable from this page (slproweb.com/products/Win32OpenSSL.html). Which DLLs should i copy to project folder?

                      Thanks.

                      raven-worxR 1 Reply Last reply
                      0
                      • J jemazter

                        @raven-worx said in Qt and Octopart API:

                        @jemazter said in Qt and Octopart API:

                        I installed OpenSSL but i keep getting the same errors

                        Following is important here:

                        1. what version of OpenSSL?
                        2. is the path to the OpenSSL DLLs in the PATH env variable, so the application can find and load it? Alternatively you can copy the 2 DLLs right next to your application exe (or to be more specific here: into the current working directory, which might not necessarily be the directory the exe is in when starting the application from QtCreator for example)

                        Hi.

                        I installed v1.1.0c. I installed it using an executable from this page (slproweb.com/products/Win32OpenSSL.html). Which DLLs should i copy to project folder?

                        Thanks.

                        raven-worxR Offline
                        raven-worxR Offline
                        raven-worx
                        Moderators
                        wrote on last edited by
                        #11

                        @jemazter
                        OpenSSL 1.1.x support is still missing...see QTBUG-52905
                        You need to stick to OpenSSL 1.0.x for now.

                        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                        If you have a question please use the forum so others can benefit from the solution in the future

                        1 Reply Last reply
                        0
                        • J Offline
                          J Offline
                          jemazter
                          wrote on last edited by
                          #12

                          @raven-worx

                          I installed v1.0.2j, copied the DLLs to project folder, and still the same errors.

                          Sorry for the many questions, i'm a newbie to Qt and this is the first "complicated project" i'm doing om my own.

                          raven-worxR 1 Reply Last reply
                          0
                          • J jemazter

                            @raven-worx

                            I installed v1.0.2j, copied the DLLs to project folder, and still the same errors.

                            Sorry for the many questions, i'm a newbie to Qt and this is the first "complicated project" i'm doing om my own.

                            raven-worxR Offline
                            raven-worxR Offline
                            raven-worx
                            Moderators
                            wrote on last edited by raven-worx
                            #13

                            @jemazter said in Qt and Octopart API:

                            I installed v1.0.2j, copied the DLLs to project folder, and still the same errors.

                            as i said before, this approach still has some pitfalls. You can do this once your application is ready for release.
                            For now it's easier to add the path to DLLs to the PATH variable, and make sure you restart QtCreator after doing this.
                            If you don't want to change the system env variables, you can also set the PATH variable in QtCreator directly, then they only take effect for the started application (from within QtCreator).

                            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                            If you have a question please use the forum so others can benefit from the solution in the future

                            1 Reply Last reply
                            0
                            • J Offline
                              J Offline
                              jemazter
                              wrote on last edited by
                              #14

                              Thanks to everybody for the help.

                              I found out that the errors Qt was showing could be ignored for my application. I probably had other errors in my code, because of that i had no responses from the server, that led me to believe that that errors were the cause to no response from the server.

                              I was researching about network use in Qt and found this tutorial that coud be useful in the future for someone viewing this thread. It really solved some doubts and it worked here with Octopart API Server. (https://youtu.be/_gSC60y8woA)

                              1 Reply Last reply
                              0

                              • Login

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • Users
                              • Groups
                              • Search
                              • Get Qt Extensions
                              • Unsolved