Coder Social home page Coder Social logo

thecopy / apiary2postman Goto Github PK

View Code? Open in Web Editor NEW
204.0 6.0 28.0 41 KB

Tool for generating a Postman collection from Blueprint API markup or the Apiary API

License: MIT License

Python 100.00%
api-blueprint python postman-collection apiary drafter postman postman-apps

apiary2postman's People

Contributors

abhijitkane avatar emoabj avatar kylef avatar nick13jaremek avatar salvo1404 avatar thecopy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

apiary2postman's Issues

Creating Postman creators community

Hi Erik, I help Postman with their developer community. We are thinking of reaching out to people who have created apps or tools related to Postman. I couldn't find your email on your site or here so thought I'd write GH issue. Hope you don't mind!

If you are interested to learn more, feel free to message me - priyanka @ getpostman.com

403 Error

Thanks for the great tool. Just wanted to pass along a 403 error I'm getting:

$ apiary2postman api <api-key> <api-name>
Traceback (most recent call last):
File "/usr/local/bin/apiary2postman", line 9, in <module> load_entry_point('apiary2postman==0.4.1', 'console_scripts', 'apiary2postman')()
File "/Library/Python/2.7/site-packages/apiary2postman/apiary2postman.py", line 87, in main blueprint = fetch_blueprint(args.name[0], apikey)
File "/Library/Python/2.7/site-packages/apiary2postman/apiary.py", line 10, in fetch_blueprint response_body = json.loads(urlopen(request).read())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 127, in urlopen return _opener.open(url, data, timeout)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 410, in open response = meth(req, response)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 523, in http_response 'http', request, response, code, msg, hdrs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 448, in error return self._call_chain(*args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 382, in _call_chain result = func(*args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 531, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) 
urllib2.HTTPError: HTTP Error 403: Forbidden

Wrong URLs in postman dump

Hi,
I tried exporting both directly from apiary using apiary2postman api my_api > my_api.dump, and also converting the blueprint file using apiary2postman blueprint some.blueprint > postman.dump.

In Apiary, I have /user/ endpoint with multiple calls under it (/user/refferal, /user/register/, etc.). When I import the final dump into Postman, all of the mentioned calls are in the folder based on endpoint (which is correct), but they all have the same url /user/, not their whole respective urls as they should have.

I also checked the json generated by Drafter, and it contains the correct data (different url for each call), so it seems it is not correctly parsed by apiary2postman.

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 358: ordinal not in range(128)

I have an API blueprint doc containing french text and it causes a bug in apiary2postman convertion :

Traceback (most recent call last):
  File "/usr/local/bin/apiary2postman", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/apiary2postman/apiary2postman.py", line 99, in main
    input = blueprint2json(args.blueprint_input.read())
  File "/usr/local/lib/python2.7/site-packages/apiary2postman/blueprint.py", line 15, in blueprint2json
    out, err = p.communicate(blueprint.encode('utf8'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 358: ordinal not in range(128)

Dependencies confusion

Hi, I believe it would be better to include prerequisites in the "installation section" - I've missed it at first and was having an error "no such file or directory" โ€“ it actually took me some time to understand that there is nothing wrong with my file paths, and that the snowcrash was not installed.

Another suggestion: if snowcrash import fails it would be bice to raise an error, that explicitly says something like "Couldn't find snowcrash, please install it to use apiary2postman"

Though, that's a great tool, thank you!

Not supporting Python 3

I get a lot of errors from print 'Something'

print 'Please provide an api-key or set APIARY_API_KEY'
                                                                                            ^
SyntaxError: Missing parentheses in call to 'print'

Dockerization

Hello,

any plans to wrap this tool by Docker? I can help if you want.

Thanks Peter

Body data empty when POST/PUT request is defined in MSON

Hi,
When I create a postman file using apiary2postman to my blueprint file, where I used MSON to define any structure, the created postman doesn't contain any body data in the POST and PUT requests.

Is apiary2postman incompatible with MSON blueprint annotation?

This is my blueprint/MSON definition:

  • Request (application/hal+json)

    • Headers

        Accept-Charset: utf-8
      
    • Body

    • Attributes (object)

      • title: Modified title (string, optional)
      • description: Modified description (string, optional)
      • type: TASK (string, optional)
      • category: 210486 (string, optional)

And this is the generated postman for this request:

{
responses: [ ],
dataMode: "params",
tests: "",
description: "A new goal will be created using this action. This action takes a JSON payload as a part of the request. Response then return specific header and body + type (STRING) - Type of type of goal + title (string) - Title of the goal + description (string) - Description of the goal + creator (string) - Position id of the Goal creator + category (string) - Category of the created Goal ",
collectionId: "edeef016-6b25-487b-9269-1972535c0142",
url: "{{HOST}}/positions/132/periods/103/goals",
method: "POST",
headers: "Content-Type: application/hal+json Accept-Charset: utf-8 X-AUTH-TOKEN: {{token}} X-FORWARDED-HOST: local-133.umantis.lan Accept: application/hal+json;charset=UTF-8",
descriptionFormat: "html",
version: 2,
time: 1488549551,
synced: false,
pathVariables: { },
folder: "0d82c745-cfeb-4142-83a4-73009ac018a6",
data: [ ],
id: "ca288b97-cef6-497e-98de-520b4b09c273",
name: "Create a new goal"
},

.... where data is empty.

Upgrade to drafter

Hi,

Any chance to update to drafter ? Snowcrash cannot be installed anymore as CLI. It looks like just a replacement.

Collection undefined

When I convert my API blueprint to a Postman collection and then run newman, I get a "Collection undefined" in the summary:

image

Through trial and error, I found that if I add an order element in the top-level object inside collection.json:

image

I get the folder listing that I would expect. The screenshot at the top is me running newman twice in a row and, before the second run, modifying collection.json in another window to add the order.

Any idea why the order isn't getting made when I convert from blueprint?

Need to downgrade drafter to v0.1.9 or earlier

Latest drafter JSON output seems to be incompatible with the tool. To workaround that we had to switch to an earlier version, e.g. v0.1.9. This is the command:

brew install --HEAD https://raw.githubusercontent.com/apiaryio/drafter/b3dce8dda5d48b36e963abeffe5b0de7afecac3d/tools/homebrew/drafter.rb

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.