Uploaded image for project: 'Red Hat 3scale API Management'
  1. Red Hat 3scale API Management
  2. THREESCALE-5212

JSON API lists application plans with a different tag than XML API

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Minor Minor
    • None
    • SaaS
    • System
    • None
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Hide

      1. Call the endpoints in the examples provided with at least one application plan in your service.

      2. Observe the difference in both outputs: the type fields disappears from JSON, and the tag used to describe offset becomes the type value, breaking the expectation that it is just "plan", both because that's what XML uses and because other resources behave that way when responding with JSON.

      Show
      1. Call the endpoints in the examples provided with at least one application plan in your service. 2. Observe the difference in both outputs: the type fields disappears from JSON, and the tag used to describe offset becomes the type value, breaking the expectation that it is just "plan", both because that's what XML uses and because other resources behave that way when responding with JSON.

      Another difference between the XML and JSON versions of the same endpoint. This one is pretty surprising. In XML the type of the plan application_plan is used as the value of the field type, whereas in the JSON version the type field disappears and becomes the tag for the object. In the XML version the tag for the object is just plan.

      For reference find below both versions:

      XML:

      $ curl -v  -X GET "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820/application_plans.xml?access_token=<TOKEN>" | xmllint --format -
      
      <?xml version="1.0" encoding="UTF-8"?>
      <plans>
        <plan custom="false" default="true">
          <id>2357356012630</id>
          <name>gold</name>
          <type>application_plan</type>
          <state>published</state>
          <approval_required>false</approval_required>
          <setup_fee>0.0</setup_fee>
          <cost_per_month>0.0</cost_per_month>
          <trial_period_days>0</trial_period_days>
          <cancellation_period>0</cancellation_period>
          <service_id>2555417777820</service_id>
        </plan>
        <plan custom="false" default="false">
          <id>2357356012631</id>
          <name>silver</name>
          <type>application_plan</type>
          <state>published</state>
          <approval_required>false</approval_required>
          <setup_fee>0.0</setup_fee>
          <cost_per_month>0.0</cost_per_month>
          <trial_period_days>0</trial_period_days>
          <cancellation_period>0</cancellation_period>
          <service_id>2555417777820</service_id>
        </plan>
        <plan custom="false" default="false">
          <id>2357356113485</id>
          <name>config-DB8qe3HXVpk</name>
          <type>application_plan</type>
          <state>hidden</state>
          <approval_required>false</approval_required>
          <setup_fee>0.0</setup_fee>
          <cost_per_month>0.0</cost_per_month>
          <trial_period_days/>
          <cancellation_period>0</cancellation_period>
          <service_id>2555417777820</service_id>
        </plan>
        <plan custom="false" default="false">
          <id>2357356113486</id>
          <name>config-JuTEpSpXODk</name>
          <type>application_plan</type>
          <state>hidden</state>
          <approval_required>false</approval_required>
          <setup_fee>0.0</setup_fee>
          <cost_per_month>0.0</cost_per_month>
          <trial_period_days/>
          <cancellation_period>0</cancellation_period>
          <service_id>2555417777820</service_id>
        </plan>
        <plan custom="false" default="false">
          <id>2357356113487</id>
          <name>config-gw7l0IgFGLQ</name>
          <type>application_plan</type>
          <state>hidden</state>
          <approval_required>false</approval_required>
          <setup_fee>0.0</setup_fee>
          <cost_per_month>0.0</cost_per_month>
          <trial_period_days/>
          <cancellation_period>0</cancellation_period>
          <service_id>2555417777820</service_id>
        </plan>
        <plan custom="false" default="false">
          <id>2357356113488</id>
          <name>config-B0l8Kxzr0_I</name>
          <type>application_plan</type>
          <state>hidden</state>
          <approval_required>false</approval_required>
          <setup_fee>0.0</setup_fee>
          <cost_per_month>0.0</cost_per_month>
          <trial_period_days/>
          <cancellation_period>0</cancellation_period>
          <service_id>2555417777820</service_id>
        </plan>
        <plan custom="false" default="false">
          <id>2357356113628</id>
          <name>config-K9YMiYvtxS8</name>
          <type>application_plan</type>
          <state>hidden</state>
          <approval_required>false</approval_required>
          <setup_fee>0.0</setup_fee>
          <cost_per_month>0.0</cost_per_month>
          <trial_period_days/>
          <cancellation_period>0</cancellation_period>
          <service_id>2555417777820</service_id>
        </plan>
        <plan custom="false" default="false">
          <id>2357356113629</id>
          <name>config-WO1zqocNSbE</name>
          <type>application_plan</type>
          <state>hidden</state>
          <approval_required>false</approval_required>
          <setup_fee>0.0</setup_fee>
          <cost_per_month>0.0</cost_per_month>
          <trial_period_days/>
          <cancellation_period>0</cancellation_period>
          <service_id>2555417777820</service_id>
        </plan>
        <plan custom="false" default="false">
          <id>2357356117805</id>
          <name>fbfdhrh</name>
          <type>application_plan</type>
          <state>hidden</state>
          <approval_required>false</approval_required>
          <setup_fee>0.0</setup_fee>
          <cost_per_month>0.0</cost_per_month>
          <trial_period_days/>
          <cancellation_period>0</cancellation_period>
          <service_id>2555417777820</service_id>
        </plan>
      </plans>
      

      JSON:

      curl -v  -X GET "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820/application_plans.json?access_token=<TOKEN> | jq"
      
      {
        "plans": [
          {
            "application_plan": {
              "id": 2357356012630,
              "name": "gold",
              "state": "published",
              "setup_fee": 0,
              "cost_per_month": 0,
              "trial_period_days": 0,
              "cancellation_period": 0,
              "approval_required": false,
              "default": true,
              "created_at": "2019-03-19T09:04:40+00:00",
              "updated_at": "2019-03-19T09:04:40+00:00",
              "custom": false,
              "system_name": "gold",
              "links": [
                {
                  "rel": "service",
                  "href": "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820"
                },
                {
                  "rel": "self",
                  "href": "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820/application_plans/2357356012630"
                }
              ]
            }
          },
          {
            "application_plan": {
              "id": 2357356012631,
              "name": "silver",
              "state": "published",
              "setup_fee": 0,
              "cost_per_month": 0,
              "trial_period_days": 0,
              "cancellation_period": 0,
              "approval_required": false,
              "default": false,
              "created_at": "2019-03-19T09:04:40+00:00",
              "updated_at": "2019-03-19T09:04:41+00:00",
              "custom": false,
              "system_name": "silver",
              "links": [
                {
                  "rel": "service",
                  "href": "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820"
                },
                {
                  "rel": "self",
                  "href": "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820/application_plans/2357356012631"
                }
              ]
            }
          },
          {
            "application_plan": {
              "id": 2357356113485,
              "name": "config-DB8qe3HXVpk",
              "state": "hidden",
              "setup_fee": 0,
              "cost_per_month": 0,
              "trial_period_days": 0,
              "cancellation_period": 0,
              "approval_required": false,
              "default": false,
              "created_at": "2019-07-12T12:51:16+01:00",
              "updated_at": "2019-07-12T12:51:16+01:00",
              "custom": false,
              "system_name": "config_db8qe3hxvpk",
              "links": [
                {
                  "rel": "service",
                  "href": "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820"
                },
                {
                  "rel": "self",
                  "href": "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820/application_plans/2357356113485"
                }
              ]
            }
          },
          {
            "application_plan": {
              "id": 2357356113486,
              "name": "config-JuTEpSpXODk",
              "state": "hidden",
              "setup_fee": 0,
              "cost_per_month": 0,
              "trial_period_days": 0,
              "cancellation_period": 0,
              "approval_required": false,
              "default": false,
              "created_at": "2019-07-12T12:51:34+01:00",
              "updated_at": "2019-07-12T12:51:34+01:00",
              "custom": false,
              "system_name": "config_jutepspxodk",
              "links": [
                {
                  "rel": "service",
                  "href": "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820"
                },
                {
                  "rel": "self",
                  "href": "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820/application_plans/2357356113486"
                }
              ]
            }
          },
          {
            "application_plan": {
              "id": 2357356113487,
              "name": "config-gw7l0IgFGLQ",
              "state": "hidden",
              "setup_fee": 0,
              "cost_per_month": 0,
              "trial_period_days": 0,
              "cancellation_period": 0,
              "approval_required": false,
              "default": false,
              "created_at": "2019-07-12T12:56:22+01:00",
              "updated_at": "2019-07-12T12:56:22+01:00",
              "custom": false,
              "system_name": "config_gw7l0igfglq",
              "links": [
                {
                  "rel": "service",
                  "href": "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820"
                },
                {
                  "rel": "self",
                  "href": "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820/application_plans/2357356113487"
                }
              ]
            }
          },
          {
            "application_plan": {
              "id": 2357356113488,
              "name": "config-B0l8Kxzr0_I",
              "state": "hidden",
              "setup_fee": 0,
              "cost_per_month": 0,
              "trial_period_days": 0,
              "cancellation_period": 0,
              "approval_required": false,
              "default": false,
              "created_at": "2019-07-12T12:56:39+01:00",
              "updated_at": "2019-07-12T12:56:39+01:00",
              "custom": false,
              "system_name": "config_b0l8kxzr0_i",
              "links": [
                {
                  "rel": "service",
                  "href": "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820"
                },
                {
                  "rel": "self",
                  "href": "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820/application_plans/2357356113488"
                }
              ]
            }
          },
          {
            "application_plan": {
              "id": 2357356113628,
              "name": "config-K9YMiYvtxS8",
              "state": "hidden",
              "setup_fee": 0,
              "cost_per_month": 0,
              "trial_period_days": 0,
              "cancellation_period": 0,
              "approval_required": false,
              "default": false,
              "created_at": "2019-07-15T16:57:00+01:00",
              "updated_at": "2019-07-15T16:57:00+01:00",
              "custom": false,
              "system_name": "config_k9ymiyvtxs8",
              "links": [
                {
                  "rel": "service",
                  "href": "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820"
                },
                {
                  "rel": "self",
                  "href": "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820/application_plans/2357356113628"
                }
              ]
            }
          },
          {
            "application_plan": {
              "id": 2357356113629,
              "name": "config-WO1zqocNSbE",
              "state": "hidden",
              "setup_fee": 0,
              "cost_per_month": 0,
              "trial_period_days": 0,
              "cancellation_period": 0,
              "approval_required": false,
              "default": false,
              "created_at": "2019-07-15T16:57:27+01:00",
              "updated_at": "2019-07-15T16:57:27+01:00",
              "custom": false,
              "system_name": "config_wo1zqocnsbe",
              "links": [
                {
                  "rel": "service",
                  "href": "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820"
                },
                {
                  "rel": "self",
                  "href": "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820/application_plans/2357356113629"
                }
              ]
            }
          },
          {
            "application_plan": {
              "id": 2357356117805,
              "name": "fbfdhrh",
              "state": "hidden",
              "setup_fee": 0,
              "cost_per_month": 0,
              "trial_period_days": 0,
              "cancellation_period": 0,
              "approval_required": false,
              "default": false,
              "created_at": "2019-08-15T15:57:42+01:00",
              "updated_at": "2019-08-15T15:57:42+01:00",
              "custom": false,
              "system_name": "fbfdhrh",
              "links": [
                {
                  "rel": "service",
                  "href": "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820"
                },
                {
                  "rel": "self",
                  "href": "https://istiodevel-admin.3scale.net/admin/api/services/2555417777820/application_plans/2357356117805"
                }
              ]
            }
          }
        ]
      }
      

      Assuming the XML output is the authoritative one, producing differences in the responses like the above makes it unnecessarily hard to write code that supports parsing both.

              Unassigned Unassigned
              amartine@redhat.com Alejandro Martinez Ruiz (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: