jegan

Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About jegan

  • Rank
    Community Member
  1. Hello Team, Am trying to set SDT for service instance using API which is recommended in https://www.logicmonitor.com/support/rest-api-developers-guide/v1/sdts/add-sdts/?_ga=2.235131781.507960210.1562148622-1055941791.1554297364 site. When I run script am getting below error. Could you please help me on this where I am doing mistake. Error Response Status: 200 Response Body: {"data":null,"errmsg":"No such Website","status":1400} Script content #Request Info httpVerb ='POST' resourcePath = '/sdt/sdts' data = '{"sdtType":1,"type":"ServiceSDT","serviceId":119,"startDateTime":1562321776000,"endDateTime":1562408176000}' #Construct URL url = 'https://'+ Company +'.logicmonitor.com/santaba/rest' + resourcePath #Get current time in milliseconds epoch = str(int(time.time() * 1000)) #Concatenate Request details requestVars = httpVerb + epoch + data + resourcePath #Construct signature hmac = hmac.new(AccessKey,msg=requestVars,digestmod=hashlib.sha256).hexdigest() signature = base64.b64encode(hmac) #Construct headers auth = 'LMv1 ' + AccessId + ':' + signature + ':' + epoch headers = {'Content-Type':'application/json','Authorization':auth} #Make request response = requests.post(url, data=data, headers=headers) #Print status and body of response print 'Response Status:',response.status_code print 'Response Body:',response.content