So all of the “$BALENA_SUPERVISOR_ADDRESS/v2/applications/$BALENA_APP_ID/restart-service?apikey=$BALENA_SUPERVISOR_API_KEY” can just be “127.0.0.1:48484/v2/applications/$BALENA_APP_ID/restart-service?apikey=$BALENA_SUPERVISOR_API_KEY”?
what about the key, app id and restart service?
Where $BALENA_APP_ID is the container id your want to restart and
$BALENA_SUPERVISOR_API_KEY is given by the hypervisor as an environment variable from the container.
for some reason I am getting 401 Unauthorized Response, my code:
public static async Task<string> htttpBalenaClientPostRequestAsync(string contentType, string type, string URL, string content, string authenticationToken)
{
using (var httpClient = new HttpClient())
{
using (var request = new HttpRequestMessage(new HttpMethod(type), $"http://127.0.0.1:48484/{URL}/"))
{
request.Content = new StringContent(content);
request.Content.Headers.ContentType = MediaTypeHeaderValue.Parse(contentType);
var response = await httpClient.SendAsync(request);
return response.StatusCode.ToString();
}
}
}
the command in the url is:v2/applications/ $BALENA_APP_ID/restart-service?apikey=$BALENA_SUPERVISOR_API_KEY, and I echo for the Id and the Key, it is a post request. did I not add the key?