REST API using POST for getting data

Hi Guys

I am struggling with setting up a connection to an API which uses the POST method for getting data and not the GET. Looks like Appgyver is set up differently than what this API expects.

There are three things to send in the body, 2 static values and 1 from a variable out of the app.

Thanks for the insights. If you have an idea, try to explain it to me in easy words since I am not a programmer.

Andreas

Hey @Andreas_Niedermann
Please, tell me which API you are using.

Thanks.

Hi @Fernando_Oliveira

Thanks for your answer. We are running an api by ourselves in combination with our iOS and Android app. Check out the screenshot. That’s working when using an API test program on my Mac.

I am trying to create a simple Appgyver app for support purposes.

Thanks for your help
Andreas

Hey @Andreas_Niedermann
Sorry, but please show me the settings in Appgyver and the error displayed by it.
Thanks

@Fernando_Oliveira

Error: TypeError: Preflight response is not successfulstatus: -1

because Appgyver uses GET but I need to query the server with POST

@Andreas_Niedermann

Does this mean parameters to retain certain type of information or what do you want to record/save this information?

I’m a little confused so let’s forget for a moment the HTTP Get and POST “verbs”. Objectively, what do you want to do: save information or get information?
Additionally, please replicate the settings made in the “DATA CONFIGURATOR” option of AppGyver. You are doing this, right?
Lastly, please explain to me the “GetAppUser” in your URL.
Thanks.

@Fernando_Oliveira

I would like to use the GET DATA COLLECTION from AppGyver but not use the GET but the POST method for it, since the API requires it to query information. I would like to query the API and get information from it.

The API doesn’t accept GET where all parameters are sent in the URL but it requires the parameters sent in the body with the basic http authorization sent in the header.

POST

URL
http://our-domain.com/GetAppUser

Header
basic http authorization

Body
parameter1 = static
parameter2 = static
UserId = variable

When doing this post with the UserId X I get in return a json with numerous infos about the User X

In AppGyver I would like to use the GET COLLECTION (GET), run the test and SET SCHEMA FROM RESPONSE

Hope now it is more clear what I am trying to do.

Hey @Andreas_Niedermann

First, let’s try this approach and see what happens :slight_smile:

Step 1
DATA CONFIGURATOR → BASE


Step 2

Step 3

Step 4

Good luck!

@Fernando_Oliveira

Thanks for all the work. I did exactly as you asked but still get

Error: TypeError: Preflight response is not successfulstatus: -1

Hey @Andreas_Niedermann

Okay. But don’t be discouraged :slight_smile:
This error message may also be related to IIS settings. So see this technical article (IIS Team Blog - Getting started with the IIS CORS Module). He can help resolve this situation. It will most likely be necessary to add other elements to HEADER for use through AppGyver.

Good luck.

Hi @Fernando_Oliveira yeah, thats probably the issue.

In the Web.config I found this

  <system.web>
   <compilation targetFramework="4.0" />
   <customErrors mode="Off" />
   <authorization>
     <deny users="*" />
  </authorization>
</system.web>

Problably that’s the issue

1 Like