• 0

SDT - API issue


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. 



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

Share this post

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Based on the error message "No such Website" I would verify that serviceId 119 is valid and the correct id of an individual website check and not a website group or resource.




Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now