So I have read through the API documentation and it seems simple enough:
http://docs.rancher.com/rancher/latest/en/api/api-resources/service/
Also used the curl request generator thing thats part of the API, but that seems to give an error.
curl -u “${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}”
-X POST
-H ‘Accept: application/json’
-H ‘Content-Type: application/json’
-d ‘{“serviceId”:“1s365”}’
‘https://rancher/v1/projects/1a5/services/1s366/?action=addservicelink’
Error:
{“id”:“83c11274-772b-4836-8e74-453764068073”,“type”:“error”,“links”:{},“actions”: {},“status”:422,“code”:“MissingRequired”,“message”:null,“detail”:null,“fieldName”:“serviceLink”}
So I’m pretty sure this means that the serviceLink field is required, so I tried this:
curl -u “${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}”
-X POST
-H ‘Accept: application/json’
-H ‘Content-Type: application/json’
-d ‘{“serviceLink”:“selenium-115/hub”, “serviceId”:“1s365”}’
‘https://rancher/v1/projects/1a5/services/1s366/?action=addservicelink’
Error:
{“id”:“7b0d6df2-f840-4471-a65d-f737e89bc34d”,“type”:“error”,“links”:{},“actions”:{},“status”:422,“code”:“MissingRequired”,“message”:null,“detail”:null,“fieldName”:“serviceId”}
I’m assuming that I’m just inputting the incorrect field types, although it wasn’t clear to me from the documentation what they should be. Any help would be appreciated.