01.06.2013 Views

OpenEdge Development: Mobile Applications - Product ...

OpenEdge Development: Mobile Applications - Product ...

OpenEdge Development: Mobile Applications - Product ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 3: Creating <strong>Mobile</strong> Services<br />

Using a REST client to invoke a <strong>Mobile</strong> operation<br />

Once you have constructed the correct URI for the REST resource that represents a<br />

given <strong>Mobile</strong> operation, you can specify it as part of the HTTP request to invoke the<br />

operation from a REST client, such as Postman. However, a REST client requires four<br />

basic pieces of information to send an HTTP request:<br />

• URI — As described in the previous section<br />

• Media type — Always application/json for <strong>Mobile</strong> operations<br />

• HTTP method — As specified for each <strong>Mobile</strong> operation:<br />

– Create — POST<br />

– Read — GET<br />

– Update — PUT (with no op-element in the URI—see previous section)<br />

– Delete — DELETE<br />

– Invoke — PUT (for all invoke operations, each of which is identified and<br />

distinguished from the others by the name of the implementing ABL routine<br />

specified as the op-element in the URI—see previous section)<br />

• Other HTTP request components — Especially other INPUT parameters to<br />

include in the body of the HTTP request<br />

Note that, other than the filter parameter that is passed as the op-element in the<br />

URI of a <strong>Mobile</strong> read operation request (see previous section), all other INPUT (and the<br />

input side of INPUT-OUTPUT) parameters passed to the implementing ABL routines for<br />

<strong>Mobile</strong> operations are passed in the body of the HTTP request. This includes the JSON<br />

object for an INPUT-OUTPUT temp-table or ProDataSet parameter that is passed for the<br />

<strong>Mobile</strong> create, update, and delete operations, and a JSON object with properties for<br />

passing the values of any INPUT and INPUT-OUTPUT parameters for <strong>Mobile</strong> invoke<br />

operations.<br />

For the REST client, the input JSON objects specified for relational data must conform<br />

to the structure defined by <strong>OpenEdge</strong> for passing the JSON representations of<br />

temp-tables and ProDataSets, as appropriate. For more information, see <strong>OpenEdge</strong><br />

<strong>Development</strong>: Working with JSON. Note that this structure is similar to the structure<br />

used to return the data for a <strong>Mobile</strong> read operation (GET). For an invoke operation, the<br />

property names in the simple JSON object must have the same case-sensitive names<br />

as the corresponding parameters defined in the implementing ABL routines.<br />

Note also that for the <strong>Mobile</strong> create, update, and delete operations, all of which have<br />

the same type of input JSON object for relational data, only the HTTP method specified<br />

for the HTTP request distinguishes one <strong>Mobile</strong> operation from the other.<br />

86 <strong>OpenEdge</strong> ® <strong>Development</strong>: <strong>Mobile</strong> <strong>Applications</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!