BoschSmartHome / bosch-shc-api-docs

Bosch Smart Home Controller Local REST API
Other
208 stars 44 forks source link

No success creating new client #18

Closed sepia-assistant closed 4 years ago

sepia-assistant commented 4 years ago

Hello Bosch Dev Team,

I'm trying to use the "new client" request from the Postman collection but I'm kind of lost :-( Here is what I've tried so far:

Results:

So I'm assuming https://192.168.178.7:8443/smarthome is the correct endpoint, but I don't know what to do with the error message :-( As mentioned above I'm 99,9% sure the base64 encoded password is correct and the cert is just a copy of the example.

Any ideas?

Regards, Florian

sepia-assistant commented 4 years ago

I just looked at this again in the morning and found the correct path in the pre-request script of "Set Environment Variables" :sweat_smile: https://192.168.178.7:8443/smarthome/clients Is it written somewhere that you are supposed to execute this script before doing anything? If so I've missed it and it wasn't really clear to me that this is the way Postman assigns those variables. Well it's working now and I get back a token and a remote-tunnel URL :+1: (I wonder what you can do with this remote tunnel ^^).

philbuettner commented 4 years ago

Hi Florian,

you are right, it is not documented how to set the environment variables for the Postman collection. I will update the documentation regarding this point soon.

Kind regards Phil

floppydrive commented 4 years ago

Sorry for my question but I don't get it running. I updated in Postman in the pane the of the get set environment variables wiht my stuff. SHC ip, password, etc. After that I clicked save and then send? Was that correct. When I now open the POST New client call in the collection it is not replacing the IP. So when I click SEND on the POST I get an error like: Could not get any response There was an error connecting to %7B%7Bshc_secure%7D%7D. which sounds to me like that the variable was not resovled :/ Help? :)

floppydrive commented 4 years ago

Okay I copied what I found into the pre-request script pane of the collection. But unfortunately I get now a 500 with no message :/ What about the certificate? Is that also something what I need to place into the collection?

floppydrive commented 4 years ago

Okay now figured out to copy the certificate as described into the Body of the new client request. I think so :) BUt still 500

philbuettner commented 4 years ago

Hi, the steps in general are:

  1. Enter the ip of your SHC and your base64 encrypted password in the pre-request script of Set environment variables
  2. Hit Send to set the variables
  3. Copy your certificate into the New Client script
  4. Press SHC button
  5. Hit Send to add the client

All variables change their color if they are set. You don't have to replace them, nor will they be replaced by postman.

Hope that helps!

floppydrive commented 4 years ago

Thank you for your help. The first problem was that I was not creating an Environment. You have to go to new -> Environment to create an actual environment where the variables can be stored from the Set Environment script, otherwise you have no environment where the variables are stored. Maybe this is clear to you :) but it was not to me :) Now I can execute the New Client script but I still get a 500. When you say copy certificate to the new client script, do you mean to put it into the body "certificate": "-----BEGIN CERTIFICATE-----\r ... ? I removed all line breaks as described in the documentation. I also tried the one which is given in the prerequisite tab of hte new client script. Both are giving me a 500.

philbuettner commented 4 years ago

Yes, put the certificate into the body of the request as described in the documentation.

Could you please verify the ip of your SHC. And please check if caching is deactivated in Postman settings. Check if all paths are still correct. Maybe you should start from scratch and reimport everything.

If this is still not working for you, please describe step by step what you did to get a response code of 500.

floppydrive commented 4 years ago

Thanks. After checking my config again I realized a dumb mistake that I've done. I removed the system_password_base64 instead of adding a value for it by stupid copy/paste. The 500 hundred wiht no message is probably the result of missing parameter. Maybe that could be added to the response in future to figure this mistake faster out. There are more stupid people out there :D

philbuettner commented 4 years ago

I updated the documentation regarding the environment. Now it should be clear how to setup the env. variables.