Project

General

Profile

Actions

Bug #16684

closed

Bug #16667: Add authorized network configuration in settings api

Inconsistency between GET et POST attribute name for authorizedNetworks JSON API

Added by François ARMAND about 4 years ago. Updated about 4 years ago.

Status:
Released
Priority:
N/A
Assignee:
-
Category:
Architecture - Dependencies
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
Reviewed
Fix check:
Checked
Regression:

Description

When testing authorized network API, I get for GET:

% curl -k -X GET -H "X-API-TOKEN: 976051bb-a539-4685-ab1c-a70182a1d89f-system" https://xxxx/rudder/api/latest/settings/authorizedNetworks/root | jq .
{
  "action": "getAuthorizedNetworks",
  "id": "root",
  "result": "success",
  "data": {
    "settings": [
      "192.168.52.0/24",
      "192.168.52.0/24" 
    ]
  }
}

So I tried to update with that POST, but it deleted everything:

% curl -k -X POST -H "Content-Type: application/json" -H "X-API-TOKEN: 976051bb-a539-4685-ab1c-a70182a1d89f-system" https://xxxx/rudder/api/latest/settings/authorizedNetworks/root -d '{"settings":["192.168.52.0/16"]}'  | jq .
{
  "action": "modifyAuthorizedNetworks",
  "id": "root",
  "result": "success",
  "data": {
    "settings": []
  }
}

The actual JSON is:

% curl -k -X POST -H "Content-Type: application/json" -H "X-API-TOKEN: 976051bb-a539-4685-ab1c-a70182a1d89f-system" https://xxxx/rudder/api/latest/settings/authorizedNetworks/root -d '{"authorizedNetworks":["192.168.52.0/24"]}'  | jq .
{
  "action": "modifyAuthorizedNetworks",
  "id": "root",
  "result": "success",
  "data": {
    "settings": [
      "192.168.52.0/24" 
    ]
  }
}

Two things here:

- in the "data" part, the name should be authorizedNetworks and not settings,
- if the authorizedNetworks key is missing in POSTed JSON, we should do nothing.

Finally, for consistancy with other settings, I believe we should use settings/authorized_networks/


Subtasks 1 (0 open1 closed)

Bug #16688: Changes to extractList break plugin APIReleasedFrançois ARMANDActions
Actions

Also available in: Atom PDF