1 Star 0 Fork 0

黄小辉 / odata-example

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

This is an example project that demonstrates the different capabilities in the SDL OData framework.

Starting the Service

There are several ways to start the OData Service, in this demo we have made this even easier by adding a demo class.

From Maven

It is quite easy to run the example service from the command line, the example utilises Spring-Boot which allows running the service using a single packed jar.

In order to run the example, in the cloned git repository execute the following maven command:

mvn -f example-service/pom.xml spring-boot:run

From Your favorite IDE

In order to execute the Example service in your IDE, please execute the following the Java Main method in class:

com.sdl.odata.example.service.ServiceContainer

Creating Example Content

The example service by default has only one Person in the dataset "Darkwing Duck", in order to add more example content in the service the following steps can be used. This also demonstrates how the OData service allows data creation.

In order to create some content the below sample content can be used to post data to the OData Service. Example command to create Mickey as a Person in the service, using a sample json file:

curl -i -X POST -d @src/samples/mickey.json http://localhost:8080/example.svc/Persons --header "Content-Type:application/json"

The content structure that is posted looks as follows:

{
    "@odata.context" : "http://localhost:8080/example.svc/$metadata#/Persons/$entity",  
    "@odata.id" : "/Persons(55)",  
    "id" : 55,  
    "firstName" : "Mickey",  
    "lastName" : "Mouse",  
    "age" : 83  
}

We also have two more Persons (Donald and Scrooge), which you can post as following:

curl -i -X POST -d @src/samples/donald.json http://localhost:8080/example.svc/Persons --header "Content-Type:application/json"
curl -i -X POST -d @src/samples/scrooge.json http://localhost:8080/example.svc/Persons --header "Content-Type:application/json"

空文件

简介

暂无描述 展开 收起
Java
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/neo0820/odata-example.git
git@gitee.com:neo0820/odata-example.git
neo0820
odata-example
odata-example
master

搜索帮助