I am trying to do the following but am having issues storing the variables. Using runner I have been able to use CSVs converted from JSON outputs. I am new to postman and Sonar v1 API is not the greatest in terms of what you can outright do/request. This is for a 477 teleco submission and I have never had to work this form. Sonar does output some needed data but I need to list out each account, the services they currently subscribe to, and whether that service is a data or a voice service.
Thank you all in advance for any help and incite!
Request 1 : {{sonarURL}}/api/v1/accounts?limit=100&page=1
Pulls all accounts and outputs to JSON but only stores the account IDs in a list or string of variables
JSON Response example
{
“data”: [
{
“id”: 1111,
“name”: “Test User”,
“account_status_id”: 2,
“account_type_id”: 3,
“account_groups”: [3],
“balance_due”: 64.95,
“balance_total”: “64.95”,
“sub_accounts”: ,
“next_bill_date”: “2019-02-09”,
“delinquent”: false
},
{
"id": 3333,
"name": "Pamela & Ian Lastname",
"account_status_id": 2,
"account_type_id": 1,
"account_groups": [],
"balance_due": 0,
"balance_total": "0.00",
"sub_accounts": [],
"next_bill_date": "2020-04-02",
"delinquent": false
},
}
Request 2 : {{sonarURL}}/api/v1/accounts/:account_id/services
Pull a list of all service IDs per each account ID listed in the Request 1 response. Each Service ID will also need to be stored in a variable for the following request
something like
{
“user_id”: 1111,
“service_ids”: 2222,4444,6666,8888
}
Request 3 : {{sonarURL}}/api/v1/system/services/:id
Service Lookup by ID Response Example
{
"data": {
"id": 2222,
"active": true,
"name": "Modem Rental",
"type": "expiring",
"application": "debit",
"amount": 10,
"times_to_run": 12,
"limit_adjustments": false,
"period_days": 0,
"max_amount_per_period": 0,
"taxes": [],
"roles": [],
"data_service": false,
"upload_in_kilobits": 0,
"download_in_kilobits": 0,
"technology_code": 0,
"usage_based_billing_policy_id": null,
"unit_quantity_in_gigabytes": null,
"general_ledger_code_id": 29,
"tax_exemption_amount": 0,
"voice_service": false,
"unlimited_local_minutes": false,
"unlimited_long_distance_minutes": false,
"local_minutes": null,
"local_minutes_amount": 0,
"long_distance_minutes": null,
"long_distance_minutes_amount": 0,
"first_interval_in_seconds": null,
"sub_interval_in_seconds": null,
"local_prefixes": [],
"inbound_toll_free_rate": 0,
"billing_frequency_in_months": 1,
"account_groups": []
}
}
Looks up each individual service and filters for specific parameters to output into a JSON.
Ideally, I would like something like below.
"data": {
{
"user_id": 1111,
"service_id": 2222,
"name": "Modem Rental",
"data_service": false,
"voice_service": false,
}
{
"user_id": 1111,
"service_id": 4444,
"name": "Modem Rental",
"data_service": false,
"voice_service": false,
}
{
"user_id": 3333,
"service_id": 6666,
"name": "Modem Rental",
"data_service": false,
"voice_service": false,
}
{
"user_id": 9999,
"service_id": 5555,
"name": "Modem Rental",
"data_service": false,
"voice_service": false,
}
}