Apiary: Export API as JSON, to generate client code - apiblueprint

We all know that apiary rocks (or not.. I think it does), and I was wondering what would it take to take it a step further allow users to export a JSON description of the API? (So developers can script client code generation)
This should help:
http://ttezel.github.io/blog/2013/02/23/stop-writing-rest-api-clients/

There are two directions you can explore:
you can use Alpaca to generate client SDKs. Alpaca accepts API Blueprint as one of it's input formats
for more flexibility, you can use Snowcrash to parse API Blueprint into JSON - and roll your own code generator.
There are more tools around API Blueprint available at http://apiblueprint.org/

Related

Documenting a gRPC API

One can document a REST API with OpenAPI. Is there a similarly clean and standardized way of documenting gRPC APIs? E.g. specify what values an endpoint is expecting, what the return values mean, etc. The service definitions in a .proto file do not suffice as documentation.
I just found this: https://gendocu.com/
which let you try your APIs and document the fields. Also generates code for different languages. The project looks promising.

react native - validate source using digital signature with JWS, bcrypt or react-native-crypto

I am looking for a way to validate the source of a data in my React Native application.
The application receive data in JSON format and I want to validate its source.
I don't need to encrypt the data itself but I want to process only validated data otherwise I will notify the user the data is not originated from a valid source.
I am using RN version 0.45.1
EDIT
I've read that its not a good idea to use JWS, for example:
https://paragonie.com/blog/2017/03/jwt-json-web-tokens-is-bad-standard-that-everyone-should-avoid
but instead use 'react-native-bcrypt' or 'react-native-crypto', the second package is faster??
After a lot of searching I found this solution:
https://github.com/kjur/jsrsasign
this library provides ways to:
generate:
https://kjur.github.io/jsrsasign/api/symbols/KEYUTIL.html#.generateKeypair
sign and verify:https://kjur.github.io/jsrsasign/api/symbols/KJUR.crypto.Signature.html#constructor:
and many more...

Does the JIRA REST API support querying a list of labels?

I see the is the ability to get all components of a project by doing
/project/[projectkey]/components
but I don't see any capability or documentation on how to get the list of labels that are available for a project (something like:
/project/[projectkey]/labels
Does the JIRA REST API support querying the list of labels available on a project?
Just to clarify, labels (at least the built-in JIRA ones) are global entities so they can be attached to any Issue in any Project.
As to your question - no, there's no public REST endpoint to get/change/add labels to JIRA.
Jira Cloud has /rest/api/3/label.
Jira Server provides /rest/api/2/jql/autocompletedata/suggestions?fieldName=labels which is however not paginated and only returns the first few labels (label values can be queried using &fieldValue=X).
However, as hacky workaround you can misuse the API endpoints some Atlassian Jira Gadgets are communicating with. Though this has the following disadvantages:
Are internal APIs
Atlassian apparently plans to replace Gadgets with Dashboard Items eventually
Might change behavior, see e.g. JRASERVER-67446
No pagination (?), responses can be huge
Responses are designed for Gadgets, therefore contain irrelevant data
Labels Gadget
/rest/gadget/1.0/labels/gadget/project-<PROJECT_ID>/labels
Where <PROJECT_ID> is the numeric ID of the project.
Heat Map Gadget
/rest/gadget/1.0/heatmap/generate?projectOrFilterId=<PROJECT_OR_FILTER>&statType=labels
Where <PROJECT_OR_FILTER> can be either:
project-<PROJECT_ID>
filter-<FILTER_ID>

Parse Image + Parse httpRequest replacements — migrating from Parse Cloud Code to Parse Server on Node (Heroku / AWS / DO)

I found that when using the parse-node package, you can no longer use Parse.Cloud.httpRequest. I also know that Parse's Image object won't be available.
So far, I've been able to replace some Parse promises with native ones and use axios to make network requests.
However, I'm relatively new to Node, so I'm curious as to what are the most direct replacements for these, and how do I use them?
You should still be able to use Parse.Cloud.httpRequest. But axios is a great library and it's a great idea to start using it if you want to learn nodejs. When it comes to the parse-image it has to be replaced. There is a library which claims 100% compatibilty, check it out here.

How to debug RESTful services? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm looking for an easy way to debug RESTful services. For example, most webapps can be debugged using your average web browser. Unfortunately that same browser won't allow me to test HTTP PUT, DELETE, and to a certain degree even HTTP POST.
I am not looking to automate tests. I'd like to run new services through a quick sanity check, ideally without having to writing my own client.
Use an existing 'REST client' tool that makes it easy to inspect the requests and responses, like RESTClient.
At my firm we use a variety of different tools and approaches to testing RESTful services:
We write cURL scripts - essentially a single command saved in a file. One file per resource per method. For PUT and POST, we'll usually have files containing the representations to send alongside the cURL script. For example, for a mailbox resource, we might have a file named mailbox_post.cmd, which might contain the line curl -v -X POST -u username -H 'Content-Type:application/xml' -d #mailbox_post.xml http://service/mailbox. We like this approach because we end up building a collection of tests which can be run in a batch, or at least passed around between testers, and used for regression testing.
We use cURL and RESTClient for ad-hoc tests
We have the service serve XHTML by default, so it's browsable, and add forms resources, so the service is actually partially or fully testable using a browser. This was partly inspired by some parts of RESTful Web Services, wherein the authors show that the line between web services and web applications may not need to be as solid and strict as is usually assumed.
We write functional tests as Groovy closures, using the Restlet framework, and run the tests with a test runner Groovy script. This is useful because the tests can be stateful, build on each other, and share variables, when appropriate. We find Restlet's API to be simple and intuitive, and so easy to write quick HTTP requests and test the responses, and it's even easier when used in Groovy. (I hope to share this technique, including the test runner script, on our blog soon.)
Postman, a Google Chrome extension, may be helpful.
Edit years later: Also the website of the url in case Chrome extension link gets changed: www.postman.com
I've found RequestBin useful for debugging REST requests. Post to a unique URL and request data are updated/displayed. Can help in a pinch when other tools are not available.
https://requestbin.com/
A tool I've found useful if you're running OS X Leopard:
HTTP Client
It's a very simple GUI program that allows you to craft http requests to a resource and view the response.
cURL works just fine.
You can use fiddler's Composer to debug restful services..
Updated JD 12 sep 2013: Rest Builder is now called Composer.
I ended up settling on POSTMAN
It supports all REST features I could think of, and the UI is absolutely excellent. The only downside is that it requires Chrome.
RESTTest for Firefox (an add-on). Fiddler for IE.
I'm using Soap UI to test my REST API.
It is more complete than any other tools:
fine debug requests and responses
automated testing
all GUI based
properties and properties transfer to parameterize your tests
conditional testing
performance testing
I'm not working for SmartBear.
I was already a big fan of SoapUI while using it for SOAP WebServices.
Aside from using one of the tools in Peter Hilton's response, I would have to say that scripting the tests with LWP or some similar tool may be your only option. You could bypass the use of LWP by just opening a socket, sending a raw HTTP request in and examining what you get in return. But as far as I know, there are a dearth of testing tools for this sort of domain-- most look at this problem-space primarily from the lens of a web-site developer, and for them the browser is enough of a testing platform.
I use restclient, available from Google Code. It's a simple Java Swing application which supports all HTTP methods, and allows you full control over the HTTP headers, conneg, etc.
If you want free tool for the same purpose with additional feature of multipart form data submission it is here http://code.google.com/a/eclipselabs.org/p/restclient-tool/
Firefox's has RESTClient plug-in to send different request with methods, parameters, headers etc.
You guys should check poster extension for firefox, it's simple and useful enough to use :)
I tend to write unit tests for RESTful resources using Jersey which comes with a nice REST client. The nice thing is if you implement your RESTful resources using JAX-RS then the Jersey client can reuse the entity providers such as for JAXB/XML/JSON/Atom and so forth - so you can reuse the same objects on the server side as you use on the client side unit test.
For example here is a unit test case from the Apache Camel project which looks up XML payloads from a RESTful resource (using the JAXB object Endpoints). The resource(uri) method is defined in this base class which just uses the Jersey client API.
e.g.
clientConfig = new DefaultClientConfig();
client = Client.create(clientConfig);
resource = client.resource("http://localhost:8080");
// lets get the XML as a String
String text = resource("foo").accept("application/xml").get(String.class);
because its totally missing here:
https://luckymarmot.com/paw
Is worth ever penny...

Resources