Giter Site home page Giter Site logo

toniebox-api's Introduction

TONIEBOX API

You may all know the famous Toniebox [1]. It's a handy storytelling machine for children. I'm a big fan of this device and therefor I created a small Java library so you can interact with your Tonies easier.

[1]: https://tonies.de

Build

mvn clean install

Maven Integration

<dependencies>
    <dependency>
        <groupId>rocks.voss</groupId>
        <artifactId>toniebox-api</artifactId>
        <version>2.7</version>
    </dependency>
</dependencies>

Getting Started

See code in [example/src/main/java/rocks/voss/toniebox/example/Application.java] Code can be build with

cd example
mvn clean install
java -jar target/toniebox-api-example-*.jar

Known Issues

No issues known yet

License

Apache License 2.0

toniebox-api's People

Contributors

dennisgermany avatar dependabot[bot] avatar hgschmie avatar jonasbrand avatar maximilianvoss avatar paschmal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

toniebox-api's Issues

compatibility with SSO login

Hi,
I tried setting up the toniebox sync this weekend and stumbled upon an error with the spotify-toniebox-sync v1.3 and 2.0. To trace down the error I also tried the example code for the toniebox API, resulting in the same error:

Exception in thread "main" com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "errors" (class rocks.voss.toniebox.beans.toniebox.JWTToken), not marked as ignorable (one known property: "jwt"])
 at [Source: N/A; line: -1, column: -1] (through reference chain: rocks.voss.toniebox.beans.toniebox.JWTToken["errors"])
	at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:79)
	at com.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(DeserializationContext.java:555)
	at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:708)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1160)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:315)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:121)
	at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:2860)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:1569)
	at com.fasterxml.jackson.databind.ObjectMapper.treeToValue(ObjectMapper.java:1902)
	at rocks.voss.toniebox.beans.Transformer.createBean(Transformer.java:25)
	at rocks.voss.toniebox.beans.Transformer.createBean(Transformer.java:17)
	at rocks.voss.toniebox.RequestHandler.executeRequest(RequestHandler.java:159)
	at rocks.voss.toniebox.RequestHandler.executePostRequest(RequestHandler.java:125)
	at rocks.voss.toniebox.RequestHandler.Login(RequestHandler.java:48)
	at rocks.voss.toniebox.TonieHandler.login(TonieHandler.java:43)
	at rocks.voss.toniebox.example.Application.main(Application.java:21)

The returned json passed to the ObjectMapper is: {"errors": [{"code": "ssoAuthRequired", "key": "email"}]}

Apparently, the toniecloud requires some single sign-on? There were some changes during the last weeks, where the accounts for the toniecloud and the shop were merged (https://support.tonies.com/hc/de/articles/360014603439). I got an email about this on 19th of August.
Probably this is related? Is anybody else experiencing difficulties?

Unfortunately my Java skills are non existent, so I don't see how I could fix this myself. But I'm very happy to assist wherever I can with logs/debugging/... .

(Previously mentioned here, but moved maximilianvoss/musicsync#11)

Unrecognized field "ownerName" (class rocks.voss.toniebox.beans.toniebox.Household), not marked as ignorable (6 known properties: , "access", "canLeave", "id", "image", "name", "foreignCreativeTonieContent"])

Hi,

while trying to run your spotify-toniebox-sync-App I run into this exception.
Unrecognized field "ownerName" (class rocks.voss.toniebox.beans.toniebox.Household), not marked as ignorable (6 known properties: , "access", "canLeave", "id", "image", "name", "foreignCreativeTonieContent"])
I increase the debug level to find out whats wrong,
DEBUG:rocks.voss.toniebox.beans.Transformer:createBean:20: Json: [{"id":"...","name":"...","image":"haus.svg","foreignCreativeTonieContent":true,"access":"owner","canLeave":false,"ownerName":"..."}]
It looks like that tonie changed the API. Currently the JSON response data contains a field "ownerName", which not occur before and your code is written to not ignore unknown fields. Because of the fact that the owner name is only for displaying some info, I would suggest to either ignore this field or to make this field recognizable.

Set a User-Agent HTTP header

Follow up: maximilianvoss/musicsync#27

This is in no way an official an endorsement of this project by Boxine, but personally I think it's awesome!

This night, one user sent about 1-2 requests every second which modify a Tonie over and over with the same content without waiting for it to be done transcoding.

For privacy reasons, Boxine does not associate the HTTP user-agent with detailed logging data (we just group it into android app, iOS app, other for these logs), but based on the extremely high frequency I am certain the user-agent Apache-HttpClient/4.5.5 (Java/1.8.0_275) is responsible.

This project should set an HTTP-user agent like spotify-toniebox-sync (v1.2.3) so that Boxine can report the bugs to the project causing it. After all, somewhere there is likely a user wondering why their Tonie never finishes transcoding.

Noob with problems ;-)

Hello,
it´s my first try to compile any java code, so be kind ;-)
I get following error when I try to create the jar file:

[WARNING] Javadoc Warnings
[WARNING] C:\maven\toniebox-api-master\src\main\java\rocks\voss\toniebox\TonieHandler.java:79: warning: no description for @throws
[WARNING] * @throws IOException
[WARNING] ^
[INFO] Building jar: C:\maven\toniebox-api-master\target\toniebox-api-2.8-SNAPSHOT-javadoc.jar
[INFO]
[INFO] --- maven-source-plugin:2.2.1:jar-no-fork (attach-sources) @ toniebox-api ---
[INFO] Building jar: C:\maven\toniebox-api-master\target\toniebox-api-2.8-SNAPSHOT-sources.jar
[INFO]
[INFO] --- maven-gpg-plugin:1.5:sign (sign-artifacts) @ toniebox-api ---
Der Befehl "gpg.exe" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.726 s
[INFO] Finished at: 2021-03-13T13:49:51+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.5:sign (sign-artifacts) on project toniebox-api: Exit code: 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

my system is:
Java version: 1.8.0_281, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_281\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Thanks for your help!

Unrecognized field "householdId" on CreativeTonie

It looks like the API was updated again and this field is missing:

ERROR:rocks.voss.spotifytonieboxsync.Application:main:71: IOException com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "householdId" (class rocks.voss.toniebox.beans.toniebox.CreativeTonie), not marked as ignorable (12 known properties: , "private", "chapters", "name", "live", "chaptersRemaining", "transcoding", "imageUrl", "chaptersPresent", "secondsRemaining", "id", "secondsPresent", "transcodingErrors"]) at [Source: N/A; line: -1, column: -1] (through reference chain: rocks.voss.toniebox.beans.toniebox.CreativeTonie["householdId"]) at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:79) at com.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(DeserializationContext.java:555) at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:708) at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1160) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:315) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:121) at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:151) at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:18) at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:2860) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:1569) at com.fasterxml.jackson.databind.ObjectMapper.treeToValue(ObjectMapper.java:1902) at rocks.voss.toniebox.beans.Transformer.createBean(Transformer.java:23) at rocks.voss.toniebox.beans.Transformer.createBean(Transformer.java:16) at rocks.voss.toniebox.RequestHandler.executeRequest(RequestHandler.java:159) at rocks.voss.toniebox.RequestHandler.executeGetRequest(RequestHandler.java:111) at rocks.voss.toniebox.RequestHandler.getCreativeTonies(RequestHandler.java:60) at rocks.voss.toniebox.TonieHandler.getCreativeTonies(TonieHandler.java:64) at rocks.voss.spotifytonieboxsync.Application.main(Application.java:63)

file upload not successful

I actually run the included test example and I see a file upload fail with 403:

Screen Shot 2021-06-30 at 16 56 29

(sorry for the screen shot; this is deep within the code). All the other API calls (me, chapter etc.) work fine.

When I try to reproduce that with my own code, I get a little more information:

<?xml version="1.0" encoding="UTF-8"?>
<Error>
  <Code>InvalidAccessKeyId</Code>
  <Message>The AWS Access Key Id you provided does not exist in our records.</Message>
  <AWSAccessKeyId>ASIATDG5W6LNRQPGHC7F</AWSAccessKeyId> 
  <RequestId>N1H1CPR5VTAMFD25</RequestId>
  <HostId>7G6Kx7ZLuHhvFeIrJ8ocPfkwXN/BPGVe/Ei05XGt4nDQA4Hu3FGCe6mPr8etElcT1/kQMlw+vGY=</HostId>
</Error>

... but this matches the x-amz-credential that I received from the authenticated /file API call to toniecloud...

I am a bit confused here. Does that upload actually work in different scenarios?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.