Create an entity
We can create entity remotely through SAP Gateway.
Attribute Mandatory or Optional Description content Mandatory Defines the properties of the entity. Supports JSON and Atom/XML formatting.
- To create an entity in JSON format, write the input parameters as shown in the following example.
"City": "Midland", "Country": "USA", "LanguageCode": "3", "LocalCurrencyCode": "324", "MimeType": "", "Name": "Destination Paradise", "POBox": "322", "PostalCode": "48642", "Region": "B", "Street": "100 Electric Ave", "TelephoneNumber": "5558675309", "TravelAgencyID": "0000099", "URL": "www.foo.com"
- To create an entity in XML format, write the input parameters as shown in the following example.
"<?xml version=\"1.0\" encoding=\"utf-8\"?> <entry xml:base=\"http:\/\/sapwl01.austin.ibm.com:8003\/sap\/opu\/odata\/iwbep\/RMTSAMPLEFLIGHT_2\/\" xmlns=\"http:\/\/www.w3.org\/2005\/Atom\" xmlns:m=\"http:\/\/schemas.microsoft.com\/ado\/2007\/08\/dataservices\/metadata\" xmlns:d=\"http:\/\/schemas.microsoft.com\/ado\/2007\/08\/dataservices\"> <id>http:\/\/sapwl01.austin.ibm.com:8003\/sap\/opu\/odata\/iwbep\/RMTSAMPLEFLIGHT_2\/TravelAgencies('00000099')<\/id> <title type=\"text\">TravelAgencies('00000099')<\/title> <updated>2014-07-18T14:10:27Z<\/updated> <category term=\"RMTSAMPLEFLIGHT_2.TravelAgency\" scheme=\"http:\/\/schemas.microsoft.com\/ado\/2007\/08\/dataservices\/scheme\"\/><link href=\"TravelAgencies('00000099')\" rel=\"edit\" title=\"TravelAgency\"\/> <content type=\"application\/xml\"> <m:properties> <d:TravelAgencyID>00000099<\/d:TravelAgencyID> <d:Name>Destination Paradise<\/d:Name> <d:Street>100 Electric Ave<\/d:Street> <d:POBox>322<\/d:POBox> <d:PostalCode>48642<\/d:PostalCode> <d:City>Midland<\/d:City> <d:Country>USA<\/d:Country> <d:Region>B<\/d:Region> <d:TelephoneNumber>9896002072<\/d:TelephoneNumber> <d:URL>www.foo.com<\/d:URL> <d:LanguageCode>34<\/d:LanguageCode> <d:LocalCurrencyCode>324<\/d:LocalCurrencyCode> <d:MimeType>xml<\/d:MimeType> <\/m:properties> <\/content> <\/entry>"
Results
If we use the previous examples, you receive the following response from MobileFirst Server.
{ "d": { "City": "Midland", "Country": "USA", "LanguageCode": "3", "LocalCurrencyCode": "324", "MimeType": "", "Name": "Destination Paradise", "POBox": "322", "PostalCode": "48642", "Region": "B", "Street": "100 Electric Ave", "TelephoneNumber": "5558675309", "TravelAgencyID": "00000099", "URL": "www.foo.com", "__metadata": { "id": "http:\/\/servl01.tampa.ibm.com:1234\/sap\/opu\/odata\/iwbep\/RMTSAMPLEFLIGHT_2\/TravelAgencies('00000099')", "type": "RMTSAMPLEFLIGHT_2.TravelAgency", "uri": "http:\/\/servl01.tampa.ibm.com:1234\/sap\/opu\/odata\/iwbep\/RMTSAMPLEFLIGHT_2\/TravelAgencies('00000099')" } }, "isSuccessful": true, "responseHeaders": { "content-length": "554", "content-type": "application\/json; charset=utf-8", "dataserviceversion": "2.0", "location": "http:\/\/servl01.tampa.ibm.com:1234\/sap\/opu\/odata\/iwbep\/RMTSAMPLEFLIGHT_2\/TravelAgencies('00000099')", "server": "SAP NetWeaver Application Server \/ ABAP 731" }, "statusCode": 201, "statusReason": "Created" }
Parent topic: Start an SAP adapter