Trying to get a response of a list of users like the below but I am not sure what curl command I need to use.
[ { "name": "John", "id": 1 }, { "name": "Paul", "id": 2 }, { "name": "George", "id": 6 } ]
<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="18b1d9eb-d1b1-4871-be46-e8bd21b6006d" basePath="/api" >
<http:listener-connection host="0.0.0.0" port="${http.port}" />
</http:listener-config>
<http:request-config name="HTTP_Request_configuration" doc:name="HTTP Request configuration" doc:id="8f6759dd-bce7-4e1d-b4b6-d2d10aa4e94e" >
<http:request-connection host="httpbin.org" port="80" />
</http:request-config>
<configuration-properties doc:name="Configuration properties" doc:id="68f211a7-57a9-49fb-ac67-903186eb6283" file="dev.properties" />
<ee:object-store-caching-strategy name="Caching_Strategy" doc:name="Caching Strategy" keyGenerationExpression="#[vars.id]" doc:id="6e7f8800-21fe-4569-8f3d-44f82c4b2a9c" >
<os:private-object-store maxEntries="2" entryTtl="1" entryTtlUnit="DAYS" expirationInterval="1" expirationIntervalUnit="SECONDS" doc:id="7c1b9f23-6073-4e9d-8564-c1e7e080f352" />
</ee:object-store-caching-strategy>
<flow name="users_list" doc:id="018eedab-ff49-4dcd-96f8-4589ea16272b" doc:description="This flow returns the list of users, in JSON or CSV format.">
<http:listener doc:name="Listener" doc:id="21a12799-f1e9-436e-bf62-f4083820f657" config-ref="HTTP_Listener_config" path="/users" allowedMethods="GET"/>
<ee:transform doc:name="Transform Message" doc:id="24316a99-81ac-4aa6-88cf-53196c460d40" >
<ee:message>
<ee:set-payload ><![CDATA[%dw 2.0
output application/dw
---
[{
name: 'John',
id: 1
},
{
name: 'Paul',
id: 2
},
{
name: 'George',
id: 6
}]]]></ee:set-payload>
</ee:message>
</ee:transform>
<choice doc:name="Choice" doc:id="88f50ddf-16e4-4a31-a62a-8e9952bc82e0" >
<when expression='#[output application/java
---
attributes.headers."accept" == "application/csv"]' >
<logger level="INFO" doc:name="Logger" doc:id="8c2d143f-374a-449c-b0db-65cafef416ac" message="Transforming paylod to CSV"/>
<set-payload value="#[output csv
---
payload]" doc:name="Set Payload" doc:id="442a5635-8258-4972-a5d6-8a41dc769c1c" />
</when>
<otherwise>
<logger level="INFO" doc:name="Logger" doc:id="8c048085-d5ee-4fdb-8ff8-f18ed3e37f8d" message="Transforming paylod to JSON"/>
<set-payload value="#[output application/json
---
payload]" doc:name="Set Payload" doc:id="df79375d-8adf-4dcb-b058-afc59d8cbd52" />
</otherwise>
</choice>
</flow>
<flow name="user_add" doc:id="018eedab-ff49-4dcd-96f8-4589ea16272b" doc:description="This flow mock the process of adding a user, returning the full list of available users">
<http:listener doc:name="Listener" doc:id="21a12799-f1e9-436e-bf62-f4083820f657" config-ref="HTTP_Listener_config" path="/users" allowedMethods="PUT"/>
<ee:transform doc:name="Transform Message" doc:id="24316a99-81ac-4aa6-88cf-53196c460d40">
<ee:message>
<ee:set-payload><![CDATA[%dw 2.0
output application/json
---
[{
name: 'John',
id: 1
},
{
name: 'Paul',
id: 2
},
{
name: 'George',
id: 6
}] ++ [payload]]]></ee:set-payload>
</ee:message>
</ee:transform>
</flow>I have been trying the following but I think im going down the wrong street.
-X GET "http://localhost:8081" \
Aucun commentaire:
Enregistrer un commentaire