The Micro Platform makes your services available via a public http/json API.
Query and access your services in the following ways.
The public APIs for the Platform
Namespace is a unique namespace provided only to you and your collaborators.
# get user namespace micro user namespace
Most of our core services are locked down so you’ll need to use an API token to access them.
# get your user token` MICRO_API_TOKEN=`micro user token` # curl the api curl -H "Authorization: Bearer $MICRO_API_TOKEN" https://api.m3o.dev/
You should see below or thereabouts
This section is coming soon but you can otherwise use your own user token for now.
Because all services are RPC based, HTTP requests have to be dynamically mapped to services and their endpoints. We do this very simply in the manner shown below.
# Call helloworld service with Helloworld.Call endpoint https://api.m3o.dev/helloworld/call # Call hellworld service with Greeting.Message endpoint https://api.m3o.dev/helloworld/greeting/message
As you can see if an endpoint matches the service name we can collapse the path so there’s no redundancy. We additionally map the Call endpoint much like index.html for the web so that you can simply do
A convenient hack just like the web.
Because your services are in a specific namespace you’ll have to set the
Micro-Namespace header to access them via our public api
api.m3o.com. You otherwise also get a custom url per namespace which you can read about below.
To get your namespace
NAMESPACE=`micro user namespace`
Then simply set as the header in your call
curl -H "Micro-Namespace: $NAMESPACE" https://api.m3o.dev/helloworld
This will route to your helloworld service as opposed to someone else’s!
Each user gets a custom URL based on their namespace which is
Each of your services is then path based e.g
For example to route to the helloworld service in the foobar namespace you would do
Your namespace is managed by your own set of rules which you can read about in the Authorization guide soon or just head to the Authentication tutorial.