cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Meneghino
Level 10

Simple custom API for my IP address

Hi all.

Inspired by this post by @johnsoep I tried to use ipify to get my IP.

Below is the super simple Swagger file I created, it doesn't give a response but also no errors.

I think it just needs a little tweak to work.

Can anyone help?

Many thanks.

 

{
  "swagger": "2.0",
  "info": {
    "version": "v1",
    "title": "WhatIsMyIP"
  },
  "host": "www.ipify.org",
   "schemes": [
    "https"                      
  ],
  "paths": {
    "/": {
      "get": {
        "description": "Calls ipify over https",
        "operationId": "GetMyIP",
        "responses": {
          "200": {
            "description": "Successful response",
            "schema": {
              "title": "The response of the api.",
              "type": "string"
            }
          }
        }
      }
    }
  }
}
1 ACCEPTED SOLUTION

Accepted Solutions
henrypei
Level: Powered On

Re: Have you ever got this to work?

After some research, my understanding is that PowerApps is actually acting in the middle here - users are not directly sending requests to api.ipify.org so even if all works and it still won't return the user's IP.

 

PowerApps needs to have some built-in way for us to get user IP, as well as their network/device information. Using a custom connector is not feasible.

 

I posted an idea here https://powerusers.microsoft.com/t5/PowerApps-Ideas/More-info-on-user-s-device-network-like-IP-addre... please upvote if you think it's worth it. Thanks!

12 REPLIES 12
johnsoep
Level: Powered On

Re: Simple custom API for my IP address

Thank you for your help. I looked at the code and was able to get a response by editing the following items (Set in bold):

 

{
  "swagger": "2.0",
  "info": {
    "version": "v1",
    "title": "WhatIsMyIP"
  },
  "host": "api.ipify.org",
   "schemes": [
    "https"                      
  ],
  "paths": {
    "/": {
      "get": {
        "description": "Calls ipify over https",
        "operationId": "GetMyIP",
        "responses": {
          "200": {
            "description": "Successful response",
            "schema": {
              "title": "IPAddress",
              "type": "string"
            }
          }
        }
      }
    }
  }
}

 Now I just need to add the API and see if I can get the response in my app!

johnsoep
Level: Powered On

Re: Simple custom API for my IP address

Just an update, I get the response I want in the Swagger Editor, but when I try to call the API in my app, I get a 500 - Internal Server Error.

 

Still poking at this, I think it's on the right path.

Meneghino
Level 10

Re: Simple custom API for my IP address

Thanks for taking this up, please keep me posted. I am no API specialist but always interested in new things.
Meneghino
Level 10

Re: Simple custom API for my IP address

Hi @johnsoep, did you ever get this to work?
Thanks.

johnsoep
Level: Powered On

Re: Simple custom API for my IP address

Hey @Meneghino, I haven't had the time to retackle this. I got the API working in the developer, but as soon as I connect it to a flow it breaks the flow. I think there is additional items being returned that the flow is not expecting, but I haven't had time to dive deeper into this. I'm hoping after finishing our campus opening for the semester to take a deeper look into this.

starwispy
Level: Powered On

Re: Simple custom API for my IP address

Hi @johnsoep,

Hope you have had further success with this!  Can I please ask what additional configuration is required (in addition to adding a connection to the API)?  Did you add a specific control to your app (if so what properties of that control needed configuring)?  Thanks for sharing your insight Smiley Happy

priyankbhat
Level: Powered On

Re: Simple custom API for my IP address

Hi,

 

I tried an i am getting below error.

 

{
  "error": {
    "code": 500,
    "message": "Expression value is invalid. The template field is required.",
    "source": "india-001.azure-apim.net",
    "path": "choose[2]\\when[1]",
    "clientRequestId": "acbdde75-8a50-4007-b3dc-0f31-76ed8168"
  }
}

Not sure if i am missing something here.

 

If anyone has got this working please suggest.

 

Thanks

 

Priyank

priyankbhat
Level: Powered On

Re: Simple custom API for my IP address

Hi 

 

Additionally after 15min of creation. When I done testing i got below error message.

 

Capture.JPG

 

Can someone help ?

 

Thanks

Priyank

henrypei
Level: Powered On

Have you ever got this to work?

I'm also developing an app that must get user's ip but testing the connector result in error 500.

 

{
"error": {
"code": 500,
"message": "Expression value is invalid. The template field is required.",
"source": "asia-001.azure-apim.net",
"path": "choose[2]\\when[1]",
"clientRequestId": "d0b8bbcf-a78c-4937-8607-5031-833cac3d"
}
}

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 185 members 5,573 guests
Please welcome our newest community members: