Skip FOLIO Project Navigation

How to understand "we create a JSON structure of a moduleDescriptor and POST it to Okapi"?


#1

How to POST to Okapi ?


#2

Please read and follow the Okapi Guide and Reference. If there are parts of that guide that are a problem, please message me directly.


#6

curl is a command, so this is a command line that uses HTTP post to send the contents of /tmp/okapi-proxy-test-basic.json to the Okapi Gateway:

curl -w '\n' -X POST -D - \
    -H "Content-type: application/json" \
    -d @/tmp/okapi-proxy-test-basic.json \
    http://localhost:9130/_/proxy/modules

Based on your earlier screen captures, it looks like you are using a Microsoft Windows system. That may be a significant part of your issues. The curl command is a part of Linux and MacOS operating systems, and the developers are using those two operating systems for developing Stripes and Okapi.


#8

The last curl command in the “Deploying the Module” section demonstrates this:

curl -w '\n' http://localhost:9131/testb


#9

Where is the location of the file of “okapi-proxy-test-basic.json” after being posted to Okapi and can I find it ?


#10

Are you looking for the file itself? It isn’t on the server. The contents of the JSON was read by Okapi and the configuration of the server changed as a result. The development version of Okapi uses an in-memory database, so nothing is stored to disk.


#11

It sames that every Module and Tenant will auto acquire an unique port (allocated by Okapi) after registering on Okapi , but an unique server e.g API server and UI server also using a port respectively when it is started . Therefore the result is that my module hasn’t registered on Okapi infactly because the ports of them is conflict if they are the same port.
Could help me to correct my comprehension ? Thank you !


#12

Each Okapi Module is assigned a unique port, but Okapi Modules are expected to support multitenancy (through the X-Okapi-Tenant header), so there is not a unique port for each tenant.


#14

I tried to change the path of “okapi-proxy-test-basic.json” to new path of my module e.g API Server , but it’s failed , so how could I realise my thought ?

{
  "id" : "test-basic",
  "name" : "Okapi test module",
  "provides" : [ {
    "id" : "test-basic",
    "version" : "2.2.3",
    "routingEntries" : [ {
      "methods" : [ "GET", "POST" ],
      "path" : "/testb",
      "level" : "30",
       "permissionsRequired" : [ "test-basic.needed" ],
      "permissionsDesired" : [ "test-basic.extra" ]
    } ]
  }, {
    "id" : "_tenant",
    "version" : "1.0.0",
    "interfaceType" : "system",
    "routingEntries" : [ {
      "methods" : [ "POST", "DELETE" ],
      "path" : "/_/tenant",
      "type" : "request-response"
    } ]
  } ],
  "launchDescriptor" : {
    "exec" : "java -Dport=%p -jar okapi-test-module/target/okapi-test-module-fat.jar"
  }
}

#15

Do you mean the path in the launchDescriptor setting? The path is relative to the working directory where Okapi Gateway is running.


#16

What’s the mean of "path" : "/testb" , and I want to request my API Server which URI is like 192.168.17.128:8080/index.html through Okapi , and what’s the solution ?


#17

I think you are misunderstanding the purpose of Okapi. Okapi is not a general proxy server, nor is it something that is intended to be accessed by end-users. There isn’t, and probably never would be, an index.html response from the Okapi gateway or from the Okapi modules.


#18

Is it ok to request data from oracle database through okapi directly ?


#19

The Okapi Gateway does not connect directly to the database; an Okapi Module would be the interface to any underlying storage.

Last week we released a tutorial for FOLIO from a developer perspective. You might find it valuable in understanding the concepts behind FOLIO and what needs FOLIO is designed to solve:

http://dev.folio.org/curriculum/


#20

How soon can I lean 5. Build a skeletal RAML-module-builder module on http://dev.folio.org/curriculum/ ?


#21

I can get target/domain-models-runtimes-fat.jar in module of domain-models-runtime after run mvn install on raml-models-builder , then I got directory of domain-models-runtime-fat after decompressing domain-models-runtimes-fat.jar as following capture .
As we can see there are lots of sub directories under the directory of domain-models-runtime-fat , it sames that the html of http://localhost:8081/apidocs/ come from directory of apidocs only , so what function of other directories ? Can you give an explanation ?
capture of question


#22

Excuse me , how can I access website of https://github.com/folio-org/stripes-connect/blob/master/doc/api.md.It may be that I need to be involved in team of indexdata.slack.com,can you let me join in ?


#23

The links at the bottom of that page are not related to Index Data’s internal slack team. I’ve logged a ticket to fix the missing images: https://issues.folio.org/browse/STRIPES-284