API Anfrage mit curl

  • Hallo,

    ich würde gerne mit curl eine Login Anfrage an die API stellen. Mein Kommando sieht derzeit so aus:


    Code
    curl -X POST https://ccp.netcup.net/run/webservice/servers/endpoint.php?JSON -H 'Content-Type: application/json' -d "{
       "action":"login",
       "param":{
          "apikey":"xxxxxxxxxxxx",
          "apipassword":"xxxx",
          "customernumber":"123456"
       }
    }"

    Als Antwort erhalte ich stets:

    Code
    {"serverrequestid":"0XnA5UN4j=NQFBMRS","clientrequestid":"","action":"","status":"error","statuscode":4013,"shortmessage":"Validation Error.","longmessage":"Api key missing. JSON decode failed while validating request.","responsedata":""}

    Kann mir jemand einen Tipp geben was an der Anfrage falsch ist? Mir fehlt da offenbar der Durchblick. Ich habe mich orientiert an

    Netcup Node API - netcup Kundenforum
    Hallo zusammen, Ich wollte hiermit auf meine jüngste Veröffentlichung, der Netcup Node (netcup-node) Bibliothek aufmerksam machen. Hintergrund davon ist, dass…
    forum.netcup.de

    https://github.com/b2un0/docke…rootfs/app/src/Client.php

    Danke sehr!

  • Ahhh okay, die doppelte Nutzung von " war das Problem. Hier ist die funktionierende Anfrage:


    Code
    curl -X POST https://ccp.netcup.net/run/webservice/servers/endpoint.php?JSON -H 'Content-Type: application/json' -d '{
       "action":"login",
       "param":{
          "apikey":"xxxxxxxxxxxx",
          "apipassword":"xxxx",
          "customernumber":"123456"
       }
    }'