Obtaining Service Id of a Service

Solution Verified - Updated -

Environment

  • SaaS
  • 2.X On-Premises

Issue

  • How to obtain a service_id (ID of service) corresponding to a service name when accessing 3scale API from command line ( e.g. curl )

Resolution

Extract the service_id (ID of service) from a service system name using one of the following

  • Using 3scale Toolbox
3scale service show <my-remote> <SERVICE_SYSTEM_NAME> -o json | jq '.id'
  • or
export SERVICE_ID=$(curl -s GET "https://$ADMIN_PORTAL/admin/api/services.xml?access_token=$ACCESS_TOKEN" | xmllint --xpath "//service[system_name='$SYSTEM_NAME']/id/text()" -)

Root Cause

It is not obvious how to obtain a service_id from a service whose system_name is known.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.