Swagger - Get Model to validate my API with 'assertJsonStructure' - api

I wrote an API documentation (JSON\YAML) using Swagger and now I'd like to get the Model example for each RESTful and use It to validate my API output using PHPUnit test.
Is there a way to do that?
Thank you.

Here's a repo that will allow you to do assertions on your schema with PHP unit. I hope it helps:)
https://github.com/Maks3w/SwaggerAssertions

Related

Calling a RESTful Web services for Data (Oauth 2.0 password Grant Type)

Good Day,
Is it possible to GET data into a content set for ArcGIS online? I am new to ArcGIS online. Was wondering how I can call (GET) an endpoint in json format (with some lat and lon) to dynamically update the data set when a new object is entered.
Thank you all
Sure, you can use GET to query a Feature Service: documentation (example). To edit or add data, you'll want to use ApplyEdits - that is POST only, as you can see in the documentation.
You can do that using Rest API and many other Languages.
Here are the list of all the tutorials with different languages.
Its very helpful and well guided.
All the tutorials with Rest API : https://developers.arcgis.com/labs/?product=rest-api&topic=any
Add/Update/Remove feature with Rest API and Json formats : https://developers.arcgis.com/labs/rest/add-edit-and-remove-features/

How can I generate a custom response example value in NSwag (ASP.NET Core)?

I'm trying to generate a custom response example value using NSwag. When using Swashbuckle there are attributes for it, but I'm not sure how to do it in NSwag.
I found this thread, but I'm not familiar enough with Swagger to translate the code.
Does anyone have any complete examples of how to achieve this functionality?
If you know the expected JSON field and structure of the sample, you can implement this yourself by modifying the code in this blog: https://blog.rsuter.com/nswag-tutorial-implement-a-custom-operation-processor-to-define-redoc-code-samples/

create query using webservice api for Rally

I am trying to write a query in Ruby to insert a user story in Rally using WSAPI. I read through https://rally1.rallydev.com/slm/doc/webservice/.I looked it up and found that wsapi has a create() method, but I am not aware of its signature. I know it uses PUT/Post method for creation, but I just need an example to understand how to write create queries. Does anyone know of any useful resource to know more about this? I have all my code ready, just need information about writing "create" queries using Rally's WSAPI.
Thanks
There is a full directory of Ruby REST examples in the Github Repository for RallyRestToolkitForRuby:
https://github.com/RallyTools/RallyRestToolkitForRuby/tree/master/examples
This create example may be of particular interest. It's for a Defect, but the same logic would apply to Stories:
04-create-defect.rb

Yii Framework, JSON API, Restricted by URL

I am trying to build an API service for my Yii based website,
I have create an API controller with all the functions that returns objects in JSON format.
I also created a system to generate API keys for a specific URL... but I cant seem to understand how to detect the url from where the call is being made to my api so I can compare and validate.
I have tryed with HTTP_REFERER ...not working...
Any idea how is this possible ?
Thanks
try this:
Yii::app()->request->urlReferrer
or
Yii::app()->request->host
or
Yii::app()->request->hostAddress
for more details see http://www.yiiframework.com/doc/api/1.1/CHttpRequest

how to use https://api.facebook.com/method/fql.query?query=

Hi i need to use https://api.facebook.com/method/fql.query?query= to get user profile picture and other user information on PHP.
i know that https://api.facebook.com/method/fql.query?query= return some json or XML.
but i don't know how to get json to use.
thank you
PHP has built in json support. See json_decode manual.
And if you are wondering how to run FQL from PHP - it was just asked.
You can add a parameter format=json to get result in json format. So the url will be
https://api.facebook.com/method/fql.query?query=fql&format=json&access_token=t
By default format is xml.
The REST API has been deprecated. To make FQL queries you should use the Graph API. To do so, just issue an HTTP GET request to https://graph.facebook.com/fql?q= and provide your FQL statement as the value of the q parameter. For more info, check out the FQL documentation. You can use the Graph API Explorer to easily test FQL queries.