SoundCloud API for Arduino or ESP-8266

Hello!

This is my first post here. I want to build a play counter display for my SoundCloud account. I am planning to use some 7-segment LED displays and a WeMos D1 mini. But the hardware is not what is troubling me. I have no idea how to access the SoundCloud API! I know that there's a wonderful library by witnessmenow on GitHub (GitHub - witnessmenow/arduino-youtube-api: A wrapper around the youtube api for arduino).

Is it possible to do something similar for SoundCloud?
Any help is greatly appreciated!

T-Reu:
Hello!

This is my first post here. I want to build a play counter display for my SoundCloud account. I am planning to use some 7-segment LED displays and a WeMos D1 mini. But the hardware is not what is troubling me. I have no idea how to access the SoundCloud API! I know that there's a wonderful library by witnessmenow on GitHub (GitHub - witnessmenow/arduino-youtube-api: A wrapper around the youtube api for arduino).

Is it possible to do something similar for SoundCloud?
Any help is greatly appreciated!

Must be very difficult for you to do a Google search.
https://developers.soundcloud.com/

Thanks, I did find that. But I have no clue what to do now… How is that implemented into the Arduino?

First learn HTTP, then read the SoundCloud API description. Finally, learn how to make HTTP requests using the ESP8266.

Pieter

OK, so I have made some progress. Now I need to know how to do certain things with Strings: The SoundCloud server gives a fairly long answer that I try store inside a String. After the routine runs a few times, my chip throws an error at me. All I want is the String to be completely new filled with the new information overtime the routine runs...

void loop() {

  if (millis() > zeitBeiLetzterApiAbfrage + zeitZwischenApiAbfragen)  {

    // alten String leermachen:
    vonScEmpfangen = String('a');
    
    Serial.println("\nStarting connection to server..."); 
    // if you get a connection, report back via serial:
    if (client.connect(server, 443)) {
      Serial.println("connected to server");
      // Make an HTTP request:
      client.println("GET /users/xxx/tracks?client_id=yyy HTTP/1.1"); 
      client.println("Host: api.soundcloud.com");
      client.println("Connection: close");
      client.println();
    }

    // if there are incoming bytes available 
    // from the server, read them and print them:
    while (client.connected() || client.available()) {
      char c = client.read();
      Serial.write(c);
      // String mit Antwort von SC füllen:
      vonScEmpfangen = String(vonScEmpfangen + String(c));
    }

    // if the server's disconnected, stop the client:
    if (!client.connected()) {
      Serial.println();
      Serial.println("disconnecting from server.");
      client.stop();
    }

    // irgendwie den String auswerten
    //long positionPlaycount = vonScEmpfangen.indexOf('playback_count');
    //Serial.println("\nPosition:");
    //Serial.println(positionPlaycount);
    
    zeitBeiLetzterApiAbfrage = millis();
  }
   
}

Serial Monitor shows this:

Starting connection to server...
connected to server
⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
Content-Length: 44552
Connection: close
Date: Wed, 26 Jul 2017 10:30:03 GMT
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Accept, Authorization, Content-Type, Origin
Access-Control-Allow-Methods: GET, PUT, POST, DELETE
Cache-Control: private, max-age=0, must-revalidate
Access-Control-Expose-Headers: Date
Server: am/2
X-Cache: Miss from cloudfront
Via: 1.1 67284fcf464f6f1529cc1e521669622c.cloudfront.net (CloudFront)
X-Amz-Cf-Id: tHhxkikoJKpYfxyyBG1FhRhWVcfuK-UNL97qZM_eJnv1x0wb3w7Ojg==

[{"kind":"track","id":333738043,"created_at":"2017/07/18 16:43:35 +0000","user_id":229446377,"duration":5116299,"commentable":true,"state":"finished","original_content_size":82149168,"last_modified":"2017/07/18 23:56:46 +0000","sharing":"public","tag_list":"Podcast Religion esoterik politik gesellschaft atheismus humanismus türkei lehrplan schule evolution kreationismus islam islamisierung reform goehte-moschee seyran-ates Berlin kindesmissbrauch kirche vatikan ehefüralle merkel hass definition","permalink":"fo

...
and so on 
...

/05/07 14:31:09 +0000","user_id":229446377,"duration":6380718,"commentable":true,"state":"finished","original_content_size":102379572,"last_modified":"2017/05/07 14:37:07 +0000","shari
Exception (28):
epc1=0x4000bf0e epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont 
sp: 3fff0aa0 end: 3fff0ce0 offset: 01a0

>>>stack>>>
3fff0c40:  3ffefb38 3ffefc80 3fff0c70 40203854  
3fff0c50:  3ffefb38 3ffefc80 3ffefb38 40203896  
3fff0c60:  3ffefb38 3ffefc80 3ffefb48 40201f11  
3fff0c70:  00000000 00000000 00000000 3fff400c  
3fff0c80:  00001bdf 00001bd0 3fff3bdc 0000000f  
3fff0c90:  00000001 00ffffff 0100a8c0 40203554  
3fff0ca0:  00000069 3ffefb64 3ffefc80 40201dd4  
3fff0cb0:  00000000 00000000 00000001 3ffefcac  
3fff0cc0:  3fffdad0 00000000 3ffefca4 40203a90  
3fff0cd0:  feefeffe feefeffe 3ffefcc0 40100718  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(1,6)


 ets Jan  8 2013,rst cause:4, boot mode:(1,6)

wdt reset

In case anyone is interested: I made some progress on my project. I documented it in my build blog:
http://mixedtinkerings.com/category/nixie-display/