I am using fetch function in React Native to call ASP.NET web API to get list of data in a JSON format. The response which I am getting from API is 200 (ok). But I am not getting the actual data. If I ran the same URL in Postman I am getting the data which I am expecting.
For example, I am running http://192.168.1.5:8082/api/ECommerce/GetCategory URL in GET method. If I am running the above URL in Postman I am getting the data which I expected.
If I am using the same URL in fetch function in React Native and console the response now I am getting the following:
I am not getting the list of data.
Related
I am testing apis usng postman continuously and then generating api documentation using postman app.
But problem is that documentation is not displaying api response which i am receiving in postman console. Here is the response which i am receiving for most of my apis
How can i get response body also in my api documentation?
If the request has been saved to a collection, You can use the Save as example feature, found to the top right of the response body. This will open the example builder and once saved, this response body will be shown against the request on your API documentation.
More details of how that works can be found here:
https://learning.getpostman.com/docs/postman/collections/examples/#how-your-examples-appear-in-postman-documentation
I used POST method to get token from an API using 'invokehttp' processor in Apache Nifi and successfully got the token. I tried another 'invokehttp' processor with GET method to extract the actual data, but I am getting blank output file with status success. When I use the same details using POSTMAN, it gives me expected data.
I have 2 items set up in Auth0:
Application - Single Page Application
API - Custom API, machine to machine
I've followed the instruction in the link below to call the custom API:
https://auth0.com/docs/quickstart/spa/vuejs/02-calling-an-api
I've downloaded the sample with settings configured for both items mentioned above. The Vue app are able to log in correctly, and are able to call the external API by using the downloaded example codes (the external API, "backend", in the example code was written in Node JS).
However, when I change the backend to my Laravel/Lumen app which already set up for item no.2 (custom API), the Vue app received 401 unauthorized error. So, I copied the access token retrieved through Vue:
const accessToken = await this.$auth.getTokenSilently();
console.log(accessToken);
And try to call the Lumen backend with this access token - and it works perfectly fine!
Is there a setting somewhere that I might've missed to enable Vue & Lumen to work with Auth0?
p/s: The custom Lumen API was made following the instruction from:
https://auth0.com/blog/developing-restful-apis-with-lumen/
Ok it turns out I made a mistake in the axios part of the sample code. The sample is using get, while my API is using post. So I ended up sending the header in the wrong axios parameter. Hope this helps someone that encountered the same problem.
user defined x-header doesnt send to api problem
We have a rest api configured with cors. We can access it with ajax, swift etc.
But when we try to send request from android with react-native application x-header doesnt sent in request header. Our parameters added as miscellaneous header and not sent to server.
We try to request with axios and fetch and xmlHttpRequest
By the way when we try the same request with react it works.
My environment:
android,
react-native,
axios,
fetch
xmlHttpRequest
We have been using postman for our Rest API testing but to make it more of an e2e data driven tool, we have a requirement to:
- Make postman grab data from our database and feed it to the API calls
- Run some api calls based on that data
- Query DB again to check the sanity of the data after REST POST requests for example
I know postman is for client side interactions. Is there a way to make postman to talk to DB somehow? I have came across "volos-mysql" and "dreamFactory" but problem is how to load an external module inside postman script?