certat / do-portal

This project is in maintenance mode and will only receive bug fixes, but no new features. A new version of this software is being developed.
5 stars 5 forks source link

Make the settings for each net-object availabe via RESTful-API #57

Closed certrik closed 5 years ago

certrik commented 5 years ago

Make the settings for each net-object availabe via RESTful-API like described in https://github.com/certat/do-portal/wiki/settings-implementation .

MarkHofstetter commented 5 years ago

"first iteration" of notification_settings:

get: curl -s 'http://127.0.0.1:8000/cp/1.0/ripe/settings/4/ORG-IMH1-RIPE' -H 'Origin: http://127.0.0.1:5002' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.9,de;q=0.8,es;q=0.7' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36' -H 'Accept: application/json, text/plain, */*'-H 'Referer: http://127.0.0.1:5002/' -H 'Cookie: username=cert%40master.at; rm=1|ba943e7bd05004f3d501e5dff6741fc1a30a10118cfc128d50d5916d3a01b6d246e2ff374ed0f63d1db127c6bdbaadca3ea24148b3329b79cf99770fc278a72d' -H 'Connection: keep-alive' -H 'DNT: 1' --compressed | jq . { "8596": { "delivery_format": "CSV", "delivery_protocol": "Mail", "notification_interval": null } } put/post curl -s 'http://127.0.0.1:8000/cp/1.0/ripe/settings/4/ORG-DA2-RIPE' -X PUT -H 'Origin: http://127.0.0.1:5002' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.9,de;q=0.8,es;q=0.7' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36' -H 'Content-Type: application/json;charset=UTF-8' -H 'Accept: application/json, text/plain, */*' -H 'Referer: http://127.0.0.1:5002/' -H 'Cookie: username=cert%40master.at; rm=1|ba943e7bd05004f3d501e5dff6741fc1a30a10118cfc128d50d5916d3a01b6d246e2ff374ed0f63d1db127c6bdbaadca3ea24148b3329b79cf99770fc278a72d' -H 'Connection: keep-alive' -H 'DNT: 1' --data-binary '{"asn": "25575", "notification_interval":45}' --compressed | jq . { "message": "Setting added" }

MarkHofstetter commented 5 years ago

due to Davids request:

get:
curl -s 'http://127.0.0.1:8000/cp/1.0/ripe/settings/4/ORG-IMH1-RIPE' |jq .
{
  "abusec": [
    "abuse@hotze.com"
  ],
  "asns": [
    {
      "asn": "8596",
      "notification_setting": {
        "delivery_format": "CSV",
        "delivery_protocol": "Mail",
        "notification_interval": null
      }
    }
  ],
  "cidrs": [
    {
      "cidr": "2a02:5d8::/32",
      "notification_setting": {
        "delivery_format": "CSV",
        "delivery_protocol": "Mail",
        "notification_interval": 35
      }
    },
    {
      "cidr": "185.74.0.0/22",
      "notification_setting": {}
    },
    {
      "cidr": "82.150.192.0/19",
      "notification_setting": {
        "delivery_format": "CSV",
        "delivery_protocol": "Mail",
        "notification_interval": 0
      }
    }
  ],
  "name": "hotze.com GmbH"
}
put/post:
curl 'http://127.0.0.1:8000/cp/1.0/ripe/settings/4/ORG-IMH1-RIPE' -X POST  --data-binary '{"cidr":  "2a02:5d8::/32",  "notification_setting": {"notification_interval": 35}}' -
{"message": "Setting added"}
davewood commented 5 years ago

@sebix, @certrik : Can you provide defaults for

      "notification_setting": {
        "delivery_format": "CSV",
        "delivery_protocol": "Mail",
        "notification_interval": 0
      }
ghost commented 5 years ago
      "notification_setting": {
        "delivery_format": "CSV",
        "delivery_protocol": "Mail",
        "notification_interval": 604800
      }