Is it possible to change QuickCapture "method" from "GET" to "POST"?

474
5
Jump to solution
05-26-2022 11:57 AM
PamBlackmore
New Contributor III

I'm using QuickCapture designer to create a simple app. I need to call another app through a REST API inside of QuickCapture. The API of the other app requires me to use the "POST" Method instead of the "GET" Method (see error below). Is it possible to change this method setting in the QuickCapture designer JSON or other means? 

Please let me know if you need more information. Thanks for any help!

Pam

screenshot.png

 

0 Kudos
1 Solution

Accepted Solutions
JohnathanHasthorpe
Esri Regular Contributor

Hi Pam,

QuickCapture does not allow custom html to be written in projects This is in order to meet app security requirements.

So it does seem this use case would require a custom implementation. AppStudio apps are built using QT, so do support custom html: https://doc.qt.io/qt-5/richtext-html-subset.html#using-html-markup-in-text-widgets. This makes it a possible way forward.

Do you have access to ArcGIS AppStudio and some development skills? If so I can share the QuickCapture template with you (if you email quickcapture@esri.com).

Thanks

John

View solution in original post

0 Kudos
5 Replies
JohnathanHasthorpe
Esri Regular Contributor

Hi Pam

Please can you share more details:

  • Are you using QuickCapture link buttons for this?
  • What is the app/API that you are calling and what does it do?
  • What does the URL you are using look like?

Thanks

John

0 Kudos
PamBlackmore
New Contributor III

Hi John,

Thanks so much for responding and please accept  my apology for the lack of detail in my post.

  • Are you using QuickCapture link buttons for this?
    • Yes, I am attempting to access a REST API endpoint using the the link button and entering a URL.
  • What is the app/API that you are calling and what does it do?
    • The API I'm trying to call is the Mosaic Camera API. I need it to start and stop taking pictures at a specified distance (e.g. 5 meters) A few of its methods are:
    • - GET (retrieve some information from camera)
       - POST (take an action upon camera)
       - PUT (send data to be updated in the camera)
  • What does the URL you are using look like?

Please let me know if there is any other information I can provide. Thanks so much, John!

Pam

0 Kudos
PamBlackmore
New Contributor III

Hi @JohnathanHasthorpe, I have more relevant information (I think).  I talked with one of the creators of the camera API. He said perhaps there's a way in AppStudio that I can modify the QuickCapture template to add some HTML and get it to work? He said: 

"I believe the most user friendly way (and also industrial standard) is the one, where Esri adds support for other REST API methods to be used in their framework.

Meanwhile I realised there is a way to send POST requests using pure html. See the attachment. If there is a possibility to embed HTML snippets such as this one into Esri's app, this should allow you to achieve your goal. You might need to consult Esri's documentation or contact their support to see if there is support for a widget allowing embedding of the html code in the QuickCapture Designer.

```
  <form action="http://172.31.44.1/api/v1/camera/start_recording" method="post">
    <input type="submit" value="start">
  </form>
```"

This is only a snippet of the HTML code he provided. I can provide the full HTML if that is helpful. Do you have any suggestions? Perhaps I should move this conversation over to the AppStudio questions?

Thanks!

Pam

0 Kudos
JohnathanHasthorpe
Esri Regular Contributor

Hi Pam,

QuickCapture does not allow custom html to be written in projects This is in order to meet app security requirements.

So it does seem this use case would require a custom implementation. AppStudio apps are built using QT, so do support custom html: https://doc.qt.io/qt-5/richtext-html-subset.html#using-html-markup-in-text-widgets. This makes it a possible way forward.

Do you have access to ArcGIS AppStudio and some development skills? If so I can share the QuickCapture template with you (if you email quickcapture@esri.com).

Thanks

John

0 Kudos
PamBlackmore
New Contributor III

Thanks, John! I do have the QuickCapture template. I've being watching AppStudio QML code along workshops on YouTube trying to figure out where the template needs to be amended. I can't seem to find it. All the code alongs that I can find are quite introductory. I'll keep looking, and go through the QT documentation link you provided above. Is there any AppStudio documentation that describes the QuickCapture template? This is a fair bit out of my wheelhouse, but I'm determined to learn it!

Many thanks, @JohnathanHasthorpe

Pam

0 Kudos