如何使用POSTMAN发送POST请求后从API返回数据?

时间:2018-05-28 05:09:13

标签: rest api web-services

我正在尝试使用POST方法从API返回数据,我还需要将一些参数传递给它。很长一段时间以来,我一直在尝试将数据放入正文中,并试图将其放入邮递员的表格数据中。我只想测试它以查看它返回的内容以及它是如何工作的。 API链接: -

doorhopper.in/api/user/localMarket    

我需要发送的参数是: -

"phone":if available
"latitude":if available
"longitude":if available
"regId":using any clientside logic
"token":if logged in we get a token on login
"city":"Silchar",
"category":"Swadeshi",
"categoryId":"1007"
"limit":"15"

我已经检查了很多答案,包括this,但没有帮助: -

我每次都会得到这个: -

    Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException in /var/www/html/DoorhopperServer/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php:255
Stack trace:
#0 /var/www/html/DoorhopperServer/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php(242): Illuminate\Routing\RouteCollection->methodNotAllowed(Array)
#1 /var/www/html/DoorhopperServer/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php(176): Illuminate\Routing\RouteCollection->getRouteForMethods(Object(Illuminate\Http\Request), Array)
#2 /var/www/html/DoorhopperServer/vendor/laravel/framework/src/Illuminate/Routing/Router.php(599): Illuminate\Routing\RouteCollection->match(Object(Illuminate\Http\Request))
#3 /var/www/html/DoorhopperServer/vendor/laravel/framework/src/Illuminate/Routing/Router.php(588): Illuminate\Routing\Router->findRoute(Object(Illuminate\Http\Request))
#4 /var/www/html/DoorhopperServer/vendor/laravel/framework/src/Illuminate/Routing/Router.php(577): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#5 /var/www/html/DoorhopperServer/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#6 /var/www/html/DoorhopperServer/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#7 /var/www/html/DoorhopperServer/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#8 /var/www/html/DoorhopperServer/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#9 /var/www/html/DoorhopperServer/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#10 /var/www/html/DoorhopperServer/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#11 /var/www/html/DoorhopperServer/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#12 /var/www/html/DoorhopperServer/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#13 /var/www/html/DoorhopperServer/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#14 {main}Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function send() on null in /var/www/html/DoorhopperServer/public/index.php:56
Stack trace:
#0 {main}Symfony\Component\Debug\Exception\FatalErrorException: Uncaught Error: Call to a member function send() on null in /var/www/html/DoorhopperServer/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:112
Stack trace:
#0 /var/www/html/DoorhopperServer/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(89): Illuminate\Foundation\Bootstrap\HandleExceptions->renderHttpResponse(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#2 {main}
  thrown in /var/www/html/DoorhopperServer/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:112
Stack trace:
#0 {main}

0 个答案:

没有答案