Can we add multiple passes to wallet at once? - passbook

I'm using php-pkpass library to create pass. Now can add only 1 pass at a time and I want to add multiple passes at once.
Is it possible to do this?
Thanks,

I keep seeing "NO" answers but I keep seeing companies(such as train companies) doing that just fine.
So I'm really curious as to why you can't but they can.

Short and simple NO
You can use for your own pkpass application.
The Passbook App scanner will only allow you to add a pass if ALL of the following are true:
The QR code contains a URL
The URL scheme is https and the server certificate is valid and can be authenticated (I.e not self signed)
The URL returns a Content-Type header of application/vnd.apple.pkpass
The URL body contains a single .pkpass bundle
Adding multiple passes via the Passbook App scanner from a single QR code is currently not possible. The only way to add multiple passes is via your own app using the addPasses:withCompletionHandler: method of the PKPassLibrary class.

Related

Share dynamic content on LinkedIn

I have a JS based CMS that populates a single page with different content based on URL parameters passed to the page. I am using the shareURL format (https://www.linkedin.com/shareArticle?mini=true&url=''&title=''&summary=''&source='')
But the parameters I pass are never used it always falls back to what is being served directly from the server.
Do I have to use the API to make this work and if so can I use the API without making the user authenticate?
Is there a correct way to pass this so that linked in will display the correct data.
After testing this more I realised that the linked ins share URL does not take its parameters it only takes what is served from the server. So I changed my build process not to get the pages in run time but to precompile them onto the server. Maybe in the future linked in will have resolved this for dynamic pages.

How can I create an integration test using API Connect Test and Monitor?

I've been playing around with IBM API Connect Test and Monitor (looks like a free to use rival to Postman) and would like to create an integration test (a test with multiple steps).
Looking at the example APIs it seems like it's possible, e.g. /api/examples/retail/products returns a list of products and /api/examples/retail/product (singular) looks up information on each of the products. However I can't work out how to connect the calls together. Is this definitely possible and if so how do I construct the test?
It certainly is possible to create an integration test and I can try to talk you through the steps using the example API you mentioned.
create a test in the normal way, go into "Compose" and then you may as well use the wizard option to choose "I got this, start from scratch"
Add a request and choose GET, then specify https://us-east.apitest.apiconnect.ibmcloud.com/app/api/examples/retail/products as the URL. Set the variable field to something like "products_data" or whatever you like. Save that request by clicking the tick button.
Add another request and choose "Each", set the expression to be the content of the variable you just defined, e.g. products_data.content.products. This will create a loop you can nest other requests inside. Again save and close with the tick button.
Add another request, this time a "Set (variable)". The name can be just id or whatever you like. Set the mode to string, and the value to ${_1}. Click on the tick to close and then use the mouse to drag the variable piece so it's nested under the "for each" loop.
Add one last GET request where the URL is the single item endpoint, e.g. https://us-east.apitest.apiconnect.ibmcloud.com/app/api/examples/retail/product. Inside Query Params, add the id query parameter and select "Variable" as the value, referencing id (the variable we just declared in step 4). Save and close the request and drag it into the for loop as well, underneath the variable.
Now you can run the test and it should work, generating multiple calls to the single product endpoint.
This will also work for login methods where you post to a sign-in page and obtain a session token, then use it for a set of other requests against secure endpoints.
Great question - integration testing is a powerful mechanism to simulate an actual customers interaction with your API vs. testing a single endpoint.
Here is a 2-part tutorial series that walks you through an example in detail:
Part 1: https://medium.com/apitest/how-to-never-go-hungry-again-ad0a18453fc
Part 2: https://medium.com/apitest/dessert-how-to-never-go-hungry-with-apis-3fd804515364
Hope this helps! Learn more about the product here: http://ibm.biz/apitest

Trying to create a GET request to pubgtracker

I am trying to practice my developing and wanna build my own desktop application using: https://pubgtracker.com/site-api
Before I even start the project I want to make sure that I manage to receive information from the PUBG api. Therefore I opened https://www.hurl.it/
and I try to enter the following:
GET request, and in the destination https://api.pubgtracker.com/v2/profile/pc/{pubg-nickname} (for example lucifini1 currently ranked #1)
In addition they request the API key as a header so I did the following:
+ ADD HEADER,
In the name field added TRN-Api-Key
and in the value I added my key.
When I launch request i get an: internal server error.
How can I debug it and know what I am missing?
Am I doing it correctly?
Thanks

dynamically generated pass for pasbook

I have an application that generates a barcode using a third party library. This barcode is not static and changes every 30 seconds or so from within the app.
I'm aware the proper way is to get a signed pkpass file from your server to supply to passbook, and use APN or some sort of trigger within the iOS app to acquire a new barcode. But...due to certain reasons...some of this is not viable at the moment...
So...
Ideally, I would like to be able to allow the user so that every time they select my pass, I'm able to supply them with the dynamically generated barcode (or pkpass file) from the application.
Is such a way even remotely possible? I know it doesn't really conform to "best practice"...
the proper way is to get a signed pkpass file from your server to supply to passbook
This is not just the proper way, this is the ONLY way! Passes cannot be dynamically generated and signed on the device as it would require embedding of your Pass Type ID certificate into your app.
Also, if you are generating and replacing passes with such frequency, the Passbook App will throttle your pass to preserve your users' battery and bandwidth. This would prevent your pass from updating.
An ugly hack would be to educate users to use the "pull to refresh" function on the back of the pass, then serve a new pass in response to the user request, but this would require a degree of synchronisation between your server, your app and the pass.
Practically, if the barcode is changing every 30 seconds or so, then there is a probability that the barcode expires before the user is able to retrieve the pass and present it for scanning. Perhaps there is a better way to achieve what you want without such frequent rotation of the barcode?

Is it possible to deliver more than one pass in a .PKPASS file?

use case:
A customer bought a flight for his family.
Now he wants to download all boarding passes for his flight at once and store it in passbook.
How can I solve this problem?
Can I add more than one pass descriptions in a pass.json?
Or is it possible to reference more than one pass.json files in the manifest.json?
Short answer is No. You cannot include more than one pass in the pass.json or add a reference that will be recognised by Passbook.
Long answer is that there are a number of things that you could do to make it easier for the user. These include:
Send all the passes in a single confirmation email as attachments
Include links on the back of the passes to the other passes in the same booking
Include a single link on all passes and in any confirmation mesage / email to a page with links where each pass can be downloaded
Deliver the passes via an app
The last option would provide you access to PKAddPassesViewController class, which if used with the addPasses:withCompletionHandler: of the PKPassLibrary class, would allow for multiple passes to be added.