Author Topic: Using the API  (Read 1163 times)

0 Members and 1 Guest are viewing this topic.

Offline K5MRE

  • Newbie
  • *
  • Posts: 21
  • Karma: +0/-0

  • Total Badges: 9
    Badges: (View All)
    Apple User Linux User 10 Posts
Using the API
« on: May 08, 2019, 12:34:54 pm »
All of you are familiar with the Selfcare page.  However, I wanted to make sure you're also familiar with the API that selfcare uses in the event that you want to do something creative with it.

An example is the hotspot screen that EA7KDO is working on that allows you to disconnect an active talkgroup by pushing a button on the screen.  That works by leveraging the API.

Keep in mind that right now, the API is bound to your source IP address.

To get a list of all of your hotspots that have connected to TGIF from your current IP address, their connection status, and other information, use:

http://tgif.network:5040/api/sessions

To change talkgroups, use the following:

http://tgif.network:5040/api/sessions/update/{repeater_id}/{timeslot}/{talkgroup}

Replacing {repeater_id} {timeslot} and {talkgroup} with the appropriate timeslot and talkgroup.

NOTE:  For the API, timeslot 1 is '0' and timeslot 2 is '1'.

So if you wanted to, you could create a bookmark in your tool bar with a URL like:

http://tgif.network:5040/api/sessions/update/123123101/1/4000

... which would move Timeslot 2 on hotspot 123123101 to TG 4000 (no transmit).

If you get a 200 response, the call was made successfully.  If you get any other, such as a 404, something is wrong with your query or you're not coming from the right IP address.

K5MRE
« Last Edit: May 08, 2019, 12:36:52 pm by K5MRE »

Offline WB3IHY

  • Full Member
  • ***
  • Posts: 126
  • Karma: +0/-0
  • Location: Northeast Philadelphia, Pennsylvania
    • QRZ Profile
  • Call Sign: WB3IHY

  • Total Badges: 18
    Badges: (View All)
    Fourth year Anniversary Third year Anniversary Level 4
Re: Using the API
« Reply #1 on: May 08, 2019, 05:48:59 pm »
Heh.  I was wondering if/when this would actually be published.  Had all my favorite talkgroups (plus 4000 disconnect) bookmarked ever since I saw the code on Mitch's Github and figured out how it worked.

Kept it to myself too, since I wasn't sure if doing that was officially "allowed" outside use on Mitch's screens.

Commandment number one: Thou shalt not "hack" the API...LOL.

Offline K5MRE

  • Newbie
  • *
  • Posts: 21
  • Karma: +0/-0

  • Total Badges: 9
    Badges: (View All)
    Apple User Linux User 10 Posts
Re: Using the API
« Reply #2 on: May 08, 2019, 07:31:39 pm »
Ha!  No worries at all.  Enjoy!

Offline N4VKF

  • Newbie
  • *
  • Posts: 23
  • Karma: +0/-0
  • Location: Spotsylvania, VA

  • Total Badges: 17
    Badges: (View All)
    Fourth year Anniversary Level 4 Third year Anniversary
Re: Using the API
« Reply #3 on: September 26, 2019, 01:40:04 pm »
Is there a way to add an API to the pi-star software like the brandmeister network has created?

Like Like x 2 View List

Offline Kn4usa

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
  • Call Sign: KN4USA

  • Total Badges: 7
    Badges: (View All)
    Level 2 First Post Second year Anniversary
Re: Using the API
« Reply #4 on: January 05, 2023, 01:02:00 pm »
Seems the folks that run this show don't keep up with it. I would love to know that too since when I am in pi-star adn cant connect or disonect to tgif. and it gives me a API error


 

TGIF Network - Thank God It's Friday!