| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| <api name="TestApi" |
| displayName="REST Test API" |
| apiGroupPath="test-api" |
| description="This API exposes REST endpoints for testing purposes." |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/rest-api.xsd"> |
| |
| <resource name="example" path="/createRestOrderExample"> |
| <operation verb="post" consumes="application/json" produces="application/json"> |
| <service name="createRestOrderExample"/> |
| <example type="response" code="200"> |
| <![CDATA[ |
| { |
| "statusCode": 200, |
| "statusDescription": "OK", |
| "data": { |
| "orderId": "DEMO-001" |
| } |
| } |
| ]]> |
| </example> |
| </operation> |
| </resource> |
| |
| <!-- TEST-services --> |
| <!-- The exposed endpoints are neccessary for tests defined in RestTestHttpRequest.java to run.--> |
| <!-- If you decide to remove / not publish this rest.xml, those tests need to be commented out. --> |
| |
| <resource name="test" path="/returnSuccess"> |
| <operation verb="post" consumes="application/json" produces="application/json"> |
| <service name="returnSuccess"/> |
| </operation> |
| </resource> |
| |
| <resource name="test" path="/returnSuccessButOverwriteStatusCode"> |
| <operation verb="post" consumes="application/json" produces="application/json"> |
| <service name="returnSuccessButOverwriteStatusCode"/> |
| </operation> |
| </resource> |
| |
| <resource name="test" path="/useCustomHeaderAsServiceParameter"> |
| <operation verb="post" consumes="application/json" produces="application/json" customHeaders="x-custom-header"> |
| <service name="useCustomHeaderAsServiceParameter"/> |
| </operation> |
| </resource> |
| |
| <resource name="test" path="/useLocaleSetInRequestHeader"> |
| <operation verb="post" consumes="application/json" produces="application/json"> |
| <service name="useLocaleSetInRequestHeader"/> |
| </operation> |
| </resource> |
| |
| <resource name="test" path="/{myInput}/testServiceInputParametersAsPath/"> |
| <operation verb="get" consumes="application/json" produces="application/json"> |
| <service name="testServiceInputParameters"/> |
| </operation> |
| </resource> |
| |
| <resource name="test" path="/testServiceInputParametersAsQueryParam/"> |
| <operation verb="get" consumes="application/json" produces="application/json"> |
| <service name="testServiceInputParameters"/> |
| <queryParam name="myInput" type="string" description="example input" /> |
| </operation> |
| </resource> |
| |
| <mapping name="RestOrderExample" className="org.apache.ofbiz.ws.rs.examples.RestOrderExample"/> |
| |
| </api> |