Get JSON Web Token
1 min
code examples curl request get \\ \ url 'https //api ionos com/cloudapi/v6/datacenters/{datacenterid}/servers/{serverid}/token?pretty=true\&depth=integer%3cint32%3e' \\ \ header 'accept application/json'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var requestoptions = { method 'get', headers myheaders, redirect 'follow' }; fetch("https //api ionos com/cloudapi/v6/datacenters/{datacenterid}/servers/{serverid}/token?pretty=true\&depth=integer\<int32>", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("https //api ionos com/cloudapi/v6/datacenters/{datacenterid}/servers/{serverid}/token?pretty=true\&depth=integer\<int32>") https = net http new(url host, url port) https use ssl = true request = net http get new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" response = https request(request) puts response read body import requests import json url = "https //api ionos com/cloudapi/v6/datacenters/{datacenterid}/servers/{serverid}/token?pretty=true\&depth=integer\<int32>" payload = {} headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("get", url, headers=headers, data=payload) print(response text) responses // successful operation { "token" "eyj0exaioijkv1qilcjrawqioii0mwm1mdflnc03ngy3ltqwyjctymmxmi1lzwizmtaznthlzdkilcjhbgcioijsuzi1nij9 eyjpc3mioijpb25vc2nsb3vkiiwiawf0ijoxnjayndg5ntkzmdcxlcjzzxj2zxiionsidxvpzci6ijmwngewzgvllwe3otgtndnhni04mziyltk3m2niyzc3yjg4zcisim5hbwuioijtzxj2zxiifx0 tnd9kjd8gxm39xp5pmh lnf 99al4meki eoeowpvpztirgm50azedg6sulyqzg r7vra7hefak4njb2buusizyvmhjl1qmkue5tnp0q2zynifnqnzfdu2rkroydpckpqwlmvvvzlebsz7lrkyujf qz yy 6shlftt rg6iznrtup8afzixtl 9ceswu92 gctd5liriqrsnfaigrbb0p2 6oyaqah9fewu4cxrbswumer7q4kljyzqfd0fv6utfbtpsiyci7rsb142mxylcqm4prbkgd9p5ofbjyf5lbsb9pw04wlsl9rqowggzvwsqpuzosukqrzt o5yuymt9w" }// any erroneous status code 400 (parse error), 401 (auth error), 402 (trial access), 403 (insufficient privileges), 404 (not found), 405 (unsupported http method), 415 (unsupported content type, 422 (validation error), 429 (request rate limit exceeded), 500 (server error), or 503 (maintenance) { "httpstatus" 400, "messages" \[ { "errorcode" "123", "message" "error message example " } ] }