Skip to content

Commit 9fd4279

Browse files
committed
Fixed snooze_incident
1 parent bdff7ae commit 9fd4279

3 files changed

Lines changed: 13 additions & 15 deletions

File tree

REST_API_v2/Incidents/create_incident_note.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,25 @@
3333
# Update to match your API key
3434
API_KEY = '3c3gRvzx7uGfMYEnWKvF'
3535

36+
# Update to match your email address
37+
EMAIL = 'lucas@pagerduty.com'
38+
3639
# Update to match your chosen parameters
37-
INCIDENT_ID = 'P1DIBFS'
40+
INCIDENT_ID = 'PI8BBP5'
3841
CONTENT = 'Enter your note content here'
39-
REQUESTER_ID = 'P9GJP78'
4042

4143
def get_incident():
4244
url = 'https://api.pagerduty.com/incidents/' + INCIDENT_ID + '/notes'
4345
headers = {
4446
'Accept': 'application/vnd.pagerduty+json;version=2',
4547
'Authorization': 'Token token=' + API_KEY,
46-
'Content-type': 'application/json'
48+
'Content-type': 'application/json',
49+
'From': EMAIL
4750
}
4851
payload = {
4952
'note': {
5053
'content': CONTENT
51-
},
52-
'requester_id': REQUESTER_ID
54+
}
5355
}
5456
r = requests.post(url, headers=headers, data=json.dumps(payload))
5557
print 'Status Code: ' + str(r.status_code)

REST_API_v2/Incidents/snooze_incident.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2525
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2626
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27-
#
28-
# TODO: Remove requester_id when deprecated
29-
# TODO: Test after internal server error is resolved
3027

3128
import requests
3229
import json
@@ -38,11 +35,10 @@
3835
EMAIL = 'lucas@pagerduty.com'
3936

4037
# Update to match your chosen parameters
41-
INCIDENT_ID = 'PEAWLYC'
38+
INCIDENT_ID = 'P7SP1VE'
4239
CONTENT = 'Enter your note content here'
43-
REQUESTER_ID = 'P9GJP78'
4440

45-
def get_incident():
41+
def snooze_incident():
4642
url = 'https://api.pagerduty.com/incidents/' + INCIDENT_ID + '/snooze'
4743
headers = {
4844
'Accept': 'application/vnd.pagerduty+json;version=2',
@@ -51,12 +47,12 @@ def get_incident():
5147
'From': EMAIL
5248
}
5349
payload = {
54-
'duration': 60 * 60, # 24 hours
55-
'requester_id': REQUESTER_ID
50+
'content': CONTENT,
51+
'duration': 60 * 60 * 24 # 24 hours
5652
}
5753
r = requests.post(url, headers=headers, data=json.dumps(payload))
5854
print 'Status Code: ' + str(r.status_code)
5955
print r.json()
6056

6157
if __name__ == '__main__':
62-
get_incident()
58+
snooze_incident()

REST_API_v2/Services/create_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def create_service():
6666
'description': DESCRIPTION,
6767
'escalation_policy': {
6868
'id': ESCALATION_POLICY_ID,
69-
'type': 'escalation_policy_reference'
69+
'type': 'escalation_policy'
7070
},
7171
'type': TYPE,
7272
'auto_resolve_timeout': AUTO_RESOLVE_TIMEOUT,

0 commit comments

Comments
 (0)