ibm-apiconnect / apichol Goto Github PK
View Code? Open in Web Editor NEWAPI Connect Hands-On Labs
API Connect Hands-On Labs
Working on my mac.
Enter the uri credential into the url field and your database credential into the Database field.
I think it should be uri credential into url field and name credential into Database field. You can ignore the other fields.
Might be good to have brief description for atleast the id and index field?
Might be a good idea to be a bit more verbose and include screens that the model was saved (for troubleshooting perhaps).
To open the API Designer, on the command line enter:
apic edit
The Bluemix ID login just does not work for me.
Suggest using
SKIP_LOGIN=true apic edit
or can you help me fix the login via Bluemix?
Hi,
When I issue the command below for the exercise 4 , I get "Server error, status code: 403, error code: 10003, message: You are not authorized to perform the requested action". How can I solve this issue? Thanks.
The command:
cf create-service cleardb cb5 workshopmysql
The Error:
Creating service instance workshopmysql in org MOCC / space dev as [email protected]...
FAILED
Server error, status code: 403, error code: 10003, message: You are not authorized to perform the requested action
Help users learn how to import a Swagger JSON def file, publish the APIs represented by the file and then manage them.
Assume user has already created service on Bluemix
Create Bluemix target
Publish App and API
Navigate to Bluemix and monitor running app
Use API manager to make calls to new API and store some dummy data
Ensure that you are in the LoopBack directory you created in Exercise 2
2 or 3?
GET /Employees
You might get a CORS error. Please override the CORS error as suggested in exercise 2.
I got a preflow error but eventually got since there is not step that populates the database I think @svennam92 and @joshisa - you both need to work that out.
{
"error": {
"name": "Error",
"status": 500,
"message": "ER_NO_SUCH_TABLE: Table 'ad_a0b3c7926397d25.employees' doesn't exist",
"code": "ER_NO_SUCH_TABLE",
"errno": 1146,
"sqlState": "42S02",
"index": 0,
"stack": "Error: ER_NO_SUCH_TABLE: Table 'ad_a0b3c7926397d25.employees' doesn't exist\n at Query.Sequence._packetToError (/Users/srinir16/ibm/HOLs/apichol/exercises/ex4/loopbackapp/node_modules/mysql/lib/protocol/sequences/Sequence.js:51:14)\n at Query.ErrorPacket (/Users/srinir16/ibm/HOLs/apichol/exercises/ex4/loopbackapp/node_modules/mysql/lib/protocol/sequences/Query.js:83:18)\n at Protocol._parsePacket (/Users/srinir16/ibm/HOLs/apichol/exercises/ex4/loopbackapp/node_modules/mysql/lib/protocol/Protocol.js:280:23)\n at Parser.write (/Users/srinir16/ibm/HOLs/apichol/exercises/ex4/loopbackapp/node_modules/mysql/lib/protocol/Parser.js:74:12)\n at Protocol.write (/Users/srinir16/ibm/HOLs/apichol/exercises/ex4/loopbackapp/node_modules/mysql/lib/protocol/Protocol.js:39:16)\n at Socket. (/Users/srinir16/ibm/HOLs/apichol/exercises/ex4/loopbackapp/node_modules/mysql/lib/Connection.js:109:28)\n at emitOne (events.js:96:13)\n at Socket.emit (events.js:188:7)\n at readableAddChunk (_stream_readable.js:176:18)\n at Socket.Readable.push (_stream_readable.js:134:10)\n --------------------\n at Protocol._enqueue (/Users/srinir16/ibm/HOLs/apichol/exercises/ex4/loopbackapp/node_modules/mysql/lib/protocol/Protocol.js:141:48)\n at PoolConnection.query (/Users/srinir16/ibm/HOLs/apichol/exercises/ex4/loopbackapp/node_modules/mysql/lib/Connection.js:214:25)\n at Object.eval [as forward](eval at recompile %28/usr/local/lib/node_modules/apiconnect/node_modules/strong-agent/lib/proxy.js:251:15%29, :4:32)\n at PoolConnection.query (eval at wrap (/usr/local/lib/node_modules/apiconnect/node_modules/strong-agent/lib/proxy.js:207:20), :3:21)\n at runQuery (/Users/srinir16/ibm/HOLs/apichol/exercises/ex4/loopbackapp/node_modules/loopback-connector-mysql/lib/mysql.js:183:16)\n at executeWithConnection (/Users/srinir16/ibm/HOLs/apichol/exercises/ex4/loopbackapp/node_modules/loopback-connector-mysql/lib/mysql.js:225:7)\n at Handshake.onConnect (/Users/srinir16/ibm/HOLs/apichol/exercises/ex4/loopbackapp/node_modules/mysql/lib/Pool.js:63:7)\n at Handshake. (/Users/srinir16/ibm/HOLs/apichol/exercises/ex4/loopbackapp/node_modules/continuation-local-storage/context.js:84:17)\n at bound (domain.js:280:14)\n at Handshake.runBound as _callback"
}
}
Same with PUT as well.
Cannot seem to find employeeAPI (other apps are listed) as in the instructions. Do we need to push this separately? Was this step missed?
First off, like your style of instructions. It seems very conversational.
Here's the yeah but (all rolled into one, hope you don't mind).
I never quite got connection of using the in-memory db. Does the javascript use the in memory db somewhere?
Some instructions are missing (like cd loopbackapp). In general, more instructions are better than assuming the attendees might know it (for example, not always is that hit on the process in the terminal window to terminate the process is included. It's there in some cases, not always).
Also you might want to ask attendees to cp the swagger.json to loopbackapp directory and kinda look at it and explain some salient parts (perhaps).
I am not sure looking at the JSON if it's calling the localhost or Bluemix.
The Models tab does not appear on Chrome. Seems fine on Safari and Firefox (but Firefox is slow).
The response to (at end)
http://localhost:3000/api/api/v1/mac/2
was a
{
"mac": null
}
I don't think it's correct and probably not a good idea to get back a null anyway?
Again, the no login apic edit might be better?
The standalone exercise 5 needs to be better integrated. Using a service is great, but, perhaps the goal here is
You might have an existing Data source that you want to front end with APIs, let's start by populating a data source - Employees in this exercise (exercise 5) an then make the data available via APIs, blah blah ...
I am hoping that the population can be done via Java/JDBC (our 24x7 HA application :-)).
Ex3 works fine on mac but hangs when importing JSON in the Oracle VM. Can you please try on another Linux VM?
Looks very straightforward except that I have not been able to complete 7 (yet).
npm install -g apiconnect
apic loopback
apic edit
create model
create database connection
explore APIs locally
{
"httpCode": "500",
"httpMessage": "URL Open error",
"moreInformation": "Could not connect to endpoint"
}
This might be because the table is non-existent. However, we need to verify this.
Not sure if this is a formatting issue (or the intention of this?)
at
https://github.com/ragsns/apichol/tree/master/exercises/ex3
and
OpenAPI removes the guesswork in calling the service
Formatting could be improved?
We need to look at the flow again once the exercises are better fleshed out but they seem to flow OK. Some repetitions which is good and a gradual progression.
In general within an exercise, we have to follow the cliched "say what we will say, say it, say what we said".
We also need to connect exercises.
Can we all try to look at our exercises and try to improve the intra exercise flow, inter-exercise flow, etc.?
Not sure if these are right, but starting a list
We will do a short presentation and demo. (max of 15-18 mins.) and turn the attendees loose after that.
Presentation should cover local apic, apic manager on Bluemix, API developer portal, plans, analytics, etc. and the relationship between all this.
Can we have some accounts in our back pocket just in case?
We are positioning API Connect for Microservices at JavaOne in general.
Should we try and cover the value of API C vis-a-vis a micro service example?
Java connection is at best tenuous. Not sure if we can fix this but let's brainstorm a bit more?
one section is labeled: LoopBack API using API Designer
However, it's not a LoopBack API, simply an Open API spec explorer and designer. LoopBack only applies when we connect the APIs to a LoopBack Node.js back-end, which we do in the next exercise.
After this exercise, you kind of think... "what was the point". It may be worth leading the user into the next step. Exercise 3 was simple api designing and management -- you need to create the backend yourself. So in exercise 4, we create that backend.
Could make a note that if you already have the backend, you could publish the swagger spec to Bluemix, where it would simply manage your existing APIs, like a typical API Management solution. Bluemix would provide analytics, gateway, security, authentication and user management.
can't have a .ignore file in here:
https://github.com/ragsns/apichol/tree/master/exercises/ex4/loopbackapp
Loopback complains that it needs an empty folder for the apic loopback
command.
Workaround is to use Chrome.
grep -i proxy /etc/wgetrc
use_proxy = off
wget http://chrome.richardlloyd.org.uk/install_chrome.sh
chmod +x install_chrome.sh
./install_chrome.sh
and make Chrome the default browser.
I won't close this until we've updated the VM and verified it.
There is a section in the .md of exercise 3 which has
Browse to the spec. of the section that looks similar to:
The
...fragment is skipped.
Workaround: Use the github URL in browser.
Or
a. option in pandoc to include the code in the
...blocks.
I prefer b. But we need to find solution for a as well.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.