Skip to content

Commit c98d927

Browse files
authored
Update SkyPortal annotation and comment endpoints in the ZTF Sentinel (#13)
* update SkyPortal annotation and comment endpoints used by the ZTF Sentinel * update POST data
1 parent f86695a commit c98d927

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

ztf-sentinel-service/watcher.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,6 @@ def post_annotations(self, oid: str, detection: Mapping):
490490
data["imcce_nearest_Vmag"] = float(nearest_match["V"].value)
491491

492492
annotations = {
493-
"obj_id": oid,
494493
"origin": "tails:twilight",
495494
"data": data,
496495
"group_ids": [self.config["sentinel"]["fritz"]["group_id"]],
@@ -500,10 +499,12 @@ def post_annotations(self, oid: str, detection: Mapping):
500499
log(annotations)
501500

502501
with timer(
503-
f"Posting annotation for {oid} {candid} to Fritz",
502+
f"Posting annotations for {oid} {candid} to Fritz",
504503
self.verbose > 1,
505504
):
506-
response = self.api_fritz("POST", "/api/annotation", annotations)
505+
response = self.api_fritz(
506+
"POST", f"/api/sources/{oid}/annotations", annotations
507+
)
507508
if response.json()["status"] == "success":
508509
log(f"Posted {oid} {candid} annotation to Fritz")
509510
else:
@@ -611,7 +612,6 @@ def post_comments(self, oid: str, detection: Mapping):
611612
file_content = f.read()
612613
cutouts_png = base64.b64encode(file_content).decode("utf-8")
613614
comment = {
614-
"obj_id": oid,
615615
"text": "Full-sized cutouts (256x256 px)",
616616
"group_ids": [self.config["sentinel"]["fritz"]["group_id"]],
617617
"attachment": {
@@ -620,7 +620,7 @@ def post_comments(self, oid: str, detection: Mapping):
620620
},
621621
}
622622

623-
response = self.api_fritz("POST", "/api/comment", comment)
623+
response = self.api_fritz("POST", f"/api/sources/{oid}/comments", comment)
624624
if response.json()["status"] == "success":
625625
log(f"Posted {oid} {candid} png to Fritz")
626626
else:
@@ -645,7 +645,6 @@ def post_comments(self, oid: str, detection: Mapping):
645645
.to_dict(orient="records")
646646
)
647647
comment = {
648-
"obj_id": oid,
649648
"text": "MPC and IMCCE cross-match",
650649
"group_ids": [self.config["sentinel"]["fritz"]["group_id"]],
651650
"attachment": {
@@ -656,7 +655,7 @@ def post_comments(self, oid: str, detection: Mapping):
656655
},
657656
}
658657

659-
response = self.api_fritz("POST", "/api/comment", comment)
658+
response = self.api_fritz("POST", f"/api/sources/{oid}/comments", comment)
660659
if response.json()["status"] == "success":
661660
log(f"Posted {oid} {candid} cross-matches to Fritz")
662661
else:
@@ -665,12 +664,11 @@ def post_comments(self, oid: str, detection: Mapping):
665664

666665
# post SCI image URL on IPAC's IRSA
667666
comment = {
668-
"obj_id": oid,
669667
"text": f"[SCI image from IPAC]({detection['sci_ipac_url']})",
670668
"group_ids": [self.config["sentinel"]["fritz"]["group_id"]],
671669
}
672670

673-
response = self.api_fritz("POST", "/api/comment", comment)
671+
response = self.api_fritz("POST", f"/api/sources/{oid}/comments", comment)
674672
if response.json()["status"] == "success":
675673
log(f"Posted {oid} {candid} sci image url to Fritz")
676674
else:

0 commit comments

Comments
 (0)