• 0

SDT - API issue


Question

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
 

Link to post
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.