Instant On - Wireless

 View Only

get status regularly batch job

  • 1.  get status regularly batch job

    Posted 09-09-2021 08:47 AM
    Hello.

    I want get status regularly batch job. (linux crontab)
    but Instant On has no API.

    I'm trying to call portal URL like an API.

    ex)
    site_id="...UUID 1..." # Static. part of personal portal URL
    client_id="...UUID 2..." # Static? capture https://sso.arubainstanton.com/as/token.oauth2 Form Data (by Chrome Developper Tool)
    # access_token="xxxxx" # Dynamic. capture https://sso.arubainstanton.com/as/token.oauth2 response (by Chrome Developper Tool) but expires_in:3600sec
    refresh_token="zzzzz" # Dynamic. capture https://sso.arubainstanton.com/as/token.oauth2 response (by Chrome Developper Tool) Expiration date unknown

    x=$( curl -s -X POST 'https://sso.arubainstanton.com/as/token.oauth2' \
      -d "grant_type=refresh_token&client_id=${client_id}&refresh_token=${refresh_token}" )
    access_token=$( echo ${x} | jq -r .access_token )

    x=$( curl -s -H "authorization: Bearer ${access_token}" \
      https://nb.portal.arubainstanton.com/api/sites/${site_id}/clientSummary )

    refresh_token sometimes becomes unusable.
    How Can I get refresh_token automaticaly? someone knows?

    or Is it illegal to do this?  Please advise me.
    regards.

    ------------------------------
    Takabumi Ichikawa
    ------------------------------