Skip to content

Make target_save.php POST request available via API, (to update redshift and ztfid). #117

@emirkmo

Description

@emirkmo

Currently, editing the target is possible via the website. The endpoint is /target_save.php

It takes a referrer with some targetid:
https://flows.phys.au.dk/target_edit.php?target=114

It also requires cookie and a sessionID to be set, so a logged in client. It would be great if this endpoint was also available via making a POST request to api/target.php?target=114 or something like api/target_save.php?target=114, with the data containing the updated target info. Obviously, the targetid/name should not be updatable, but everything else should be. So that it can be used from within the API without having to make a logged-in client and spoof headers etc.

just for reference, these are the fields (minus targetid/targetname).
{'target_name': '2020wtp',
'targetid': 114,
'ra': 124.99880293333,
'decl': 7.79367375,
'catalog_downloaded': True,
'discovery_mag': 19.22,
'inserted': '2020-10-26 09:52:06.485412',
'redshift': 0.07,
'redshift_error': None,
'discovery_date': '2020-10-13 11:25:26.4',
'project': 'ztf-ia',
'host_galaxy': 'api_edited',
'ztf_id': 'ZTF20aciugdl',
'target_status': 'target',
'sntype': 'Ia'}

@rhandberg
Could you add this endpoint, and also, could you please provide a list of API endpoints to me as well, so that I have access to them?

Currently, these are the known ones:
https://github.com/SNflows/tendrils/blob/da578e1eb56b9e75b3e0fd09d9de52fb13748994/tendrils/utils/urls.py#L13-L26

class RemoteUrls:
    base_url: str = 'https://flows.phys.au.dk/api/'
    datafiles_url: str = 'datafiles.php'
    targets_url: str = 'targets.php'
    sites_url: str = 'sites.php'
    set_photometry_status_url: str = 'set_photometry_status.php'
    photometry_url: str = 'download_photometry.php'
    photometry_upload_url: str = 'upload_photometry.php'
    cleanup_photometry_status_url: str = 'cleanup_photometry_status.php'
    catalogs_url: str = 'reference_stars.php'
    catalogs_missing_url: str = 'catalog_missing.php'
    filters_url: str = 'filters.php'
    lightcurves_url: str = 'lightcurve.php'
    targets_post_url: str = 'targets_add.php'

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions