Persistence And rest api

Hi guys,

I’m trying to use the spotify integration. There is a prerequisite that says you must have persistence turned on as to not loose settings after reboot. I have installed the persistence add on but cannot see a switch to turn it on. Can someone help me on where I would find it or how to turn it on.

Also in the installation instructions it says to copy client secret to spotify_client_secret in openhab e.g. through rest Api. In the rest api I can’t find anything about spotify. After some searching I found a command

curl -X PUT --header “Content-Type: text/plain” --header “Accept: application/json” -d “/[Your spotify_client_secret]” “http://openhabianpi.local:8080/rest/items/spotify_client_secret/state "

Do I put the whole code in the url bar at the top of the rest api? Or do I put it in the karif console?

Hope someone can help.

How did you set up the persistence.
Which service mapdb, influxdb…?
Please publish your item and *.persist file

In the normal console.

I just installed the add-on for persistence. I haven’t set up a service as I’m not sure which to choose. I will set the service up with the mapdb once I get home from work. Or do you recommend another service?

Bit of a silly newb here thinking it was a simple switch to turn it off and on.

Thanks for quick reply

Which one?

For restore on start up the one designed for that is mapdb

Then you need to edit the mapdb.persist in the persistence folder

Mine looks like this:
It saves everyChange and restores EVERYTHING on startup

// mapdb persistence

Strategies {
	default = everyChange
}
Items {
	* : strategy = everyChange, restoreOnStartup
}

Thanks a lot,
That’s exactly what I’m looking for. I will try it out when I get home from work.

Thanks again

It’s all in the docs, mate

OK edited a file in the persistence folder and put code from above in.

// mapdb persistence

Strategies {
default = everyChange
}
Items {
* : strategy = everyChange, restoreOnStartup
}

Is there a way I can confirm its working?

I’m really struggling to put my client id and secret from spotify into the rest api panel.

Using this code

curl -X PUT --header “Content-Type: text/plain” --header “Accept: application/json” -d “/[Your spotify_client_secret]” “http://192.168.1.107:8080/rest/items/spotify_client_secret/state "

And

curl -X PUT --header “Content-Type: text/plain” --header “Accept: application/json” -d “/[Your spotify_client_id]” “http://192.168.1.107:8080/rest/items/spotify_client_id/state "

I just keep getting reply

Can’t read swaggerJSON from etc

Can someone please tell me what I’m doing wrong.

Yes restart openHAB. The items should take their last value