How to use zapi for zephyr jira - jira-zephyr

I want to create an automated process for my tests. I am using jira and zapi. I want to try interacting with my tests in zephyr-jira using postman api. The thing is there isn't much documentation on how to use zapi.
First thing, what is the url? Is it test.atlassian.net/jira/?/?/?/apifunction?
Second thing, I can generate an access key and secret key but it seems like I also need an authorization jwt token, how can I generate one that I can use via postman?
Any help would be appriciated.

The apiary documentation is here https://getzephyr.docs.apiary.io/#
That will help you assemble the requests. What the requests and responses actually represent is still confusing (to me, anyway).
In postman: https://{{JiraHost}}/rest/zapi/latest/
some examples:
https://{{JiraHost}}/rest/zapi/latest/cycle/830
https://{{JiraHost}}/rest/zapi/latest/cycle?versionId=21689

Related

How to correctly populate Authentication request header for Xbox Live REST APIs?

I want to use the Xbox Services REST APIs, particularly one of the achievement APIs for my very first web application that I'm building. In order to use any of these APIs, I have to include a required Authorization request header in every one of my requests. This request header must be a string populated with the following information:
Authentication credentials for HTTP authentication. Example value: "XBL3.0 x=<userhash>;<token>".
However, I'm unsure of how to properly supply the missing <userhash> and <token> expected here. I found a promising lead in a similar question asked where one of the answers suggested using "authenticate of the xbox-webapi-python to get the Authorization header". I have downloaded this repository and have access to the aforementioned script. However, I'm having trouble figuring out what I specifically need to do with it to get the information I need.
Can anyone provide some guidance here or share another way to collect this header information? I'm new to python and web development, FYI!
Thanks!

Authentication for Fantasy Premier League API - Through XCode/Alamofire

I am trying to use the Fantasy Premier League Api's, however for many of them I require a session token.
According to docs, in order to achieve this I need to create a POST request and send my password/login/redirect_uri. If successful I should receive my desired session token in the response headers (which I will later use in the requests needed).
Example of how the request should look
However one thing I have noticed is that the documentation contains examples using python, and I am not sure if I can achieve the same result using the XCode environment. I have no knowledge of Python and would love to know if I can achieve the authentication using only Alamofire/URLSession.
For additional info regarding this type of authentication, you can check out these posts.
Guide 1:
https://medium.com/#bram.vanherle1/fantasy-premier-league-api-authentication-guide-2f7aeb2382e4
Guide 2:
https://medium.com/#frenzelts/fantasy-premier-league-api-endpoints-a-detailed-guide-acbd5598eb19

How to convert a Postman request into a NiFi request?

I don't mind if you use an example from another API that is not Adobe Analytics'. I just need to know the pattern that I have to follow in order to succesfully convert a Postman request into a NiFi request.
After successfully creating requests to pull reports from Adobe Analytics via Postman, I´m having difficulties to migrate these Postman requests to NiFi. I haven´t been able to find concrete use cases that explicity explain how to do this kind of task step-by-step.
I'm trying to build a backend on top of NiFi to handle multiple data extracts from Adobe Analytics in an efficient and robust way. That is instead of having to create all required scripts by myself. Yet, there is more documentation about REST APIs and Postman cases than there is about REST APIs and NiFi cases.
In the screenshot below we can see how the Postman request looks like. It takes 3 headers and 1 temporary header that includes the authorization value (Bearer token). This temporary header is generated automatically after filling in the OAuth 2.0 authorization form in the Authorization tab, as shown here.
Then, we have the body of the request. This json text is generated automatically by debugging Adobe Analytics' workspaces as shown here.
I'd like to know the following in a step-by-step manner with screenshots if possible:
Which processor(s) should I use in NiFi to obtain a similar response as the one I got in Postman?
Which properties should I add/remove from the processor to make this work?
How should I name these properties?
Is there a default property whose value/name I should modify?
As you can see, the question mainly refers to properties setup in NiFi, as well as Processor selection. I already tried to configure some processors but I don't seem to get the correct properties setup, or maybe I'm selecting the wrong processors.
I'm using NiFi v1.6.0 and Postman v7.8.0
This is most likely an easy task for users already familiar with NiFi and API requests, but it has proven challenging to me. Hopefully this will help other users looking to build more robust pipelines by using NiFi instead of doing it manually.
Thanks.
It only takes 3 NiFi processors to replicate a REST API request that works in Postman. In this solution we use a request that contains a nested JSON request. The advantage of this simple approach is that it reduces the amount of configuration required to obtain a successful response from the API. That is, even if you are using a complex JSON request. In this case the body of the JSON request is passed through the GenerateFlowFile processor, without the need of any other processor to parse/format the request.
Step #1. Create a processor called GenerateFlowFile. The only property that you will have to modify is the Custom Text. Paste in there your whole JSON request just as it was in Postman. In this case I'm using the very same JSON shown in the question above. It's a good idea to setup Yield Duration to 10 seconds or more.
Step #2. Create a processor called InvokeHTTP. Then modify the 6 properties shown in the screenshots below. Use the same Authorization details you've used in Postman. Make sure to copy the Bearer token from Postman after it has been tested. Also, don't forget to setup the HTTP Method, Remote URL and Content-Type as well.
Step #3. Finally, add a couple of LogAttribute processors to store the output of InvokeHTTP. One of these LogAttribute processors should store successful responses. The other one can be used for Failure, Original, Retry and No-Retry. Or you can create LogAttribute for each of these outputs.
Step #4. Now, connect the processors and Start your data flow! You should start seeing data populate the Successful LogAttribute. Then you can use the Data Provenance option to review the incoming data and confirm that this is exactly the same result you previously obtained from Postman.
Note: This is a simple, straightforward, "for starters" solution to replicate a Postman API request using a nested static JSON. There are more solutions in StackOverflow that tackle more complex cases, like dynamic JSON. Here's a list of some other posts:
nifi invokehttp post complex json
In NiFi processor 'InvokeHTTP' where do you write body of POST request?
Configuring HTTP POST request from Nifi

How to model different requests to same resource in api-blueprint/apiary

I'm writing some API definitions with apiary/api blueprint.
Is there a way that, for the same resource, I can use the mock endpoint to behave differently depending on input (or failing that, some kind of work around)?
For example, say I have an endpoint /login, to which you are supposed to post a username and password.
If I set up a request and response in the API that successfully logs me in, and subsequent requests and response that are error scenarios, only the first one gets triggered in the mock.
So for example, if I don't send in a username and password, I still get the logged in successfully response.
Is there any way to get the mock to do more validation or how do you work around this?
Thanks
Yes, it is possible and thoroughly described in the documentation. See http://support.apiary.io/knowledgebase/articles/117119-handling-multiple-actions-on-a-single-resource
That feature is not implemented yet, but is being worked on. Have a look at MSON, please.

How do i use an API

I've never used an API and was wondering how you use them... I would like to use facebook, twitter and vimeo's api,
Can someone explain the basics of using them, how do i access them and use them etc.
Please and thanks
Neil
How to use an API depends on the API. Usually the API creator has documentation on how to use their specific API.
Mostly, things work like the following:
You register to get a developer key. Then, you send requests to the service via HTTP (for example Twitter is using REST, which requires you to send XML or JSON to a specific http-URL providing your key). You get an answer from the service, which you must then parse and react to accordingly (for example filling a list with contacts, etc.).
Most of the time this all comes down to:
Create an XML or JSON document that describes the call parameters
Send the document to an URL using GET, POST or other request methods
Get the server's response
Parse and evaluate the response
The specific ways to use the API, especially performing authentication, can be found on the service's developer pages.
The best way to start if you want to use an API is to read it's documentation, find some tutorials and code examples. This is always/usually published by the one offering an API.
Good luck :)