Electron http request pass.telekom.de data usage


i am using a congstar sim with my electron and i am looking for a solution to see the data usage.

When the congstar sim is inserted in a smartphone, you can simply browse to pass.telekom.de and you see your actually data usage.

Now my question:

Is it possible to do it with the electron and publish the info to the dashboard?

here is the site source code:

Thanks very much,


Have you had a look at the docs Cellular.getDataUsage()?

No, because i want to see the real usage of my sim-card and not only the usage since the last reboot of the electron

If this is an HTTP site and not HTTPS you could use HTTPClient to try pulling that page.
If it’s HTTPS it might be a bit more tricky.

If you use retained RAM and/or EEPROM you can keep track of your usage even across reboots and power off phases.

1 Like


i want to use cURL in my Code ( on an Electron) is there any library or any other way to use cURL?

i want to use it for this:

curl --user-agent ‘Mozilla/4.0’ http://pass.telekom.de

I have no idea how to implement curl, parse or JSON in my code to get the http data from pass.telekom.de as desciped on the webpage.
( or is it possible to realise that with webhook? On problem is, the url pass.telekom.de must be connected via the cellular connection to get the data)

Is there anyone who can help me?

Thanks a lot!!!

Hey there,

Sounds like a doable project. I would recommend you to offer some more details in the future on what it is you’re trying to achieve, since the majority of users here most likely don’t speak German. For those who do not, @Stivi is trying to retrieve his data usage from his service provider by pinging their API. It can report back in XML, but also JSON depending on which URL you ping.

cURL is not something you can use on an Electron (as far as I’m aware). But… considering you can get some nice JSON back, webhooks are very suitable for this. I’d recommend you to check the respective docs, try the example and then give your project a shot. Let us know if you encounter issues in the process :smile:

Hi @Moors7,

thanks for the fast answer!

My main project goal is, to check my available data-volume.

One question to webhooks with particle:

Are webhooks sended by the device, in my case by electron via its cellular connection or sends the particle cloud the webhook?

Its verry important to know, because the url pass.telekom.de provides only a result when the cellular connection is used.


The electron will send an event to the cloud, which in turn will call the API. So that probably won’t work in this case.
If you need to call it directly, you probably need the httpclient on the electron, but then again, @ScruffR already told you that…

1 Like

Hello again,

i am back from vacation and i have some success with my project:

Here the code:

#include "application.h"
#include "HttpClient/HttpClient.h"
STARTUP(cellular_credentials_set("internet.t-mobile","t-mobile" ,"tm" , NULL));

#define LEDPIN D7
#define LOGGING
* Declaring the variables.
HttpClient http;

// Headers currently need to be set at init, useful for API keys etc.
http_header_t headers[] = {
    { "User-agent", "Mozilla/4.0"},
    { "Content-Type", "application/json" },
    { "Accept" , "application/json" },
    //{ "Accept" , "*/*"},
    { NULL, NULL } // NOTE: Always terminate headers will NULL

http_request_t request;
http_response_t response;

void setup() {
      Particle.keepAlive(1 * 45 );
      pinMode(LEDPIN, OUTPUT); 
  Particle.subscribe("Button_1", myHandler, MY_DEVICES);
  Particle.subscribe("High", myHandler, MY_DEVICES);
  Particle.subscribe("getUsage", getUsageHandler, MY_DEVICES);

void loop() {

void publish_messages(String message, int delay_in_ms)

void get_usage()
    Serial.println("Application>\tStart of Loop.");
    // Request path and body can be set at runtime or at setup.
    request.hostname = "pass.telekom.de";
    request.port = 80;
    request.path = "/api/service/generic/v1/status";

    // The library also supports sending a body with your request:
    //request.body = "{\"key\":\"value\"}";
    //    request.body = "{\"usedVolumeStr\":\"value\"}";
    request.body = "{\"usedVolumeStr\":}";

    // Get request
    http.get(request, response, headers);
    Serial.print("Application>\tResponse status: ");
    publish_messages(String(response.status) ,1000);

    Serial.print("Application>\tHTTP Response Body: ");
    String output = response.body;
   publish_messages(output ,1000);


void getUsageHandler(const char *event, const char *data)

i get the following response from the server:

**Application>    Start of Loop.**
**Application>    Response status: 200**
**Application>    HTTP Response Body: {"nextUpdate":300,"subscriptions":["tns","xtraSpeed"],"title":"Xtra SpeedOn","passName":"Ihr Monatsvolumen","passStage":1,"validityPeriod":4,"initialVolume":104857600,"initialVolumeStr":"100 MB","usedVolume":460800,"usedPercentage":1,"usedVolumeStr":"450 kB","usedAt":1467042910000,"remainingSeconds":2614864,"downSpeed":7200,"downSpeedStr":"7,2 Mbit/s"}**

Now my next question:

How can i parse the response to get only the “usedVolumeStr”:“450 kB” Key??

Thanks a lot


strstr() would be a way to scan your response string for a substring.

Or you could use a JSON lib.


i got it!!!

  void parseJson()
    StaticJsonBuffer<1024> jsonBuffer;
    String tmp = response.body;
    char tab2[1024];
    strncpy(tab2, tmp.c_str(), sizeof(tab2));
    tab2[sizeof(tab2) - 1] = 0;

  JsonObject& root = jsonBuffer.parseObject(tab2);

  if (!root.success()) {
    Serial.println("parseObject() failed");

  const char* usedVolume = root["usedVolumeStr"];
  publish_messages(usedVolume, 1000);



1 Like