-
Task
-
Resolution: Done
-
Major
-
None
-
None
-
None
-
False
-
False
-
Not Started
-
Not Started
-
Not Started
-
Not Started
-
Not Started
-
Not Started
-
No
-
Undefined
-
We are supposedly already doing it only for XML.
If we add this test at the end of test/integration/admin/api/services_controller_test.rb (it is not the right place for a proper test of this, because it should be more generic, for all our collections, but I am just quickly informing here):
class PaginationMetadataTest < ActionDispatch::IntegrationTest disable_transactional_fixtures! def setup @provider= FactoryBot.create(:provider_account) host! provider.admin_domain FactoryBot.create_list(:simple_service, 600, account: provider) end attr_reader :provider test 'json' do perform_request(format: :json) pp response.body end test 'xml' do perform_request(format: :xml) pp response.body end private def parsed_response JSON.parse(response.body) rescue JSON::ParserError => e pp e.class return Hash.from_xml(response.body) end def perform_request(format:) access_token_value = FactoryBot.create(:access_token, owner: provider.admin_user, scopes: %w[account_management], permission: 'ro').value get admin_api_services_path(access_token: access_token_value, format: format, per_page: 2, page: 2) assert_response :success end end
And then run it, we see the 2 following outputs:
{
"services":[
{
"service":{
"id":4,
"name":"simpleservice7",
"state":"incomplete",
"system_name":"simpleservice7",
"backend_version":1,
"deployment_option":"hosted",
"support_email":"foo33@example.net",
"intentions_required":false,
"buyers_manage_apps":true,
"buyers_manage_keys":true,
"referrer_filters_required":false,
"custom_keys_enabled":true,
"buyer_key_regenerate_enabled":true,
"mandatory_app_key":false,
"buyer_can_select_plan":false,
"buyer_plan_change_permission":"request",
"created_at":"2020-11-25T13:40:25Z",
"updated_at":"2020-11-25T13:40:25Z",
"links":[
{
"rel":"metrics",
"href":"http://admin-domain-company14.com/admin/api/services/4/metrics"
},
{
"rel":"self",
"href":"http://admin-domain-company14.com/admin/api/services/4"
},
{
"rel":"service_plans",
"href":"http://admin-domain-company14.com/admin/api/services/4/service_plans"
},
{
"rel":"application_plans",
"href":"http://admin-domain-company14.com/admin/api/services/4/application_plans"
},
{
"rel":"features",
"href":"http://admin-domain-company14.com/admin/api/services/4/features"
}
]
}
},
{
"service":{
"id":5,
"name":"simpleservice8",
"state":"incomplete",
"system_name":"simpleservice8",
"backend_version":1,
"deployment_option":"hosted",
"support_email":"foo33@example.net",
"intentions_required":false,
"buyers_manage_apps":true,
"buyers_manage_keys":true,
"referrer_filters_required":false,
"custom_keys_enabled":true,
"buyer_key_regenerate_enabled":true,
"mandatory_app_key":false,
"buyer_can_select_plan":false,
"buyer_plan_change_permission":"request",
"created_at":"2020-11-25T13:40:25Z",
"updated_at":"2020-11-25T13:40:25Z",
"links":[
{
"rel":"metrics",
"href":"http://admin-domain-company14.com/admin/api/services/5/metrics"
},
{
"rel":"self",
"href":"http://admin-domain-company14.com/admin/api/services/5"
},
{
"rel":"service_plans",
"href":"http://admin-domain-company14.com/admin/api/services/5/service_plans"
},
{
"rel":"application_plans",
"href":"http://admin-domain-company14.com/admin/api/services/5/application_plans"
},
{
"rel":"features",
"href":"http://admin-domain-company14.com/admin/api/services/5/features"
}
]
}
}
]
}
<?xml version=\"1.0\" encoding=\"UTF-8\"?> <services per_page="\"2\"" total_entries="\"601\"" total_pages="\"301\"" current_page="\"2\""> <service> <id>4</id> <account_id>2</account_id> <name>simpleservice607</name> <state>incomplete</state> <system_name>simpleservice607</system_name> <backend_version>1</backend_version><description/> <intentions_required>false</intentions_required> <buyers_manage_apps>true</buyers_manage_apps> <buyers_manage_keys>true</buyers_manage_keys> <referrer_filters_required>false</referrer_filters_required> <custom_keys_enabled>true</custom_keys_enabled> <buyer_key_regenerate_enabled>true</buyer_key_regenerate_enabled> <mandatory_app_key>false</mandatory_app_key> <buyer_can_select_plan>false</buyer_can_select_plan> <buyer_plan_change_permission>request</buyer_plan_change_permission> <deployment_option>hosted</deployment_option> <support_email>foo35@example.net</support_email> <metrics> <metric> <id>5</id> <name>hits</name> <system_name>hits</system_name> <friendly_name>Hits</friendly_name> <service_id>4</service_id> <description>Number of API hits</description> <unit>hit</unit> </metric> </metrics> </service> <service> <id>5</id> <account_id>2</account_id> <name>simpleservice608</name> <state>incomplete</state> <system_name>simpleservice608</system_name> <backend_version>1</backend_version><description/> <intentions_required>false</intentions_required> <buyers_manage_apps>true</buyers_manage_apps> <buyers_manage_keys>true</buyers_manage_keys> <referrer_filters_required>false</referrer_filters_required> <custom_keys_enabled>true</custom_keys_enabled> <buyer_key_regenerate_enabled>true</buyer_key_regenerate_enabled> <mandatory_app_key>false</mandatory_app_key> <buyer_can_select_plan>false</buyer_can_select_plan> <buyer_plan_change_permission>request</buyer_plan_change_permission> <deployment_option>hosted</deployment_option> <support_email>foo35@example.net</support_email> <metrics> <metric> <id>6</id> <name>hits</name> <system_name>hits</system_name> <friendly_name>Hits</friendly_name> <service_id>5</service_id> <description>Number of API hits</description> <unit>hit</unit> </metric> </metrics> </service> </services>
This is where the metadata is added in the code:
- relates to
-
THREESCALE-4528 Improve performance of the proxy config & /admin/api/service.json endpoints
-
- Closed
-