Difference: APPXDataAPI (3 vs. 4)

Revision 42020-08-13 - AlKalter

Line: 1 to 1
 
META TOPICPARENT name="Appx550FeaturesAppDesign"

Data API

Line: 158 to 159
 
  • Make sure you specify both <appxuser> and <appxpass> when you create the service.
  • Make sure the <appxuser> and <appxpass> you specified can log on to APPX.
  • You can point APPX_DATASVC_LOG to a file to get a log.
Added:
>
>

Using Received Data

To make use of incoming data when that data is a single record (or single item), use the .DATA GET PARAM VALUE subroutine to retrieve each value. That will only work for single records, though. However, the API can also be used to import files in json format. Read through the --- RAWJSON memory file, and look for records where RAWJSON PATH is /data/{VariableName} - the specified data will be in RAWJSON VALUE. All are alpha fields, of course. Since json files are sequential, you can identify which field will start each record and which will end it. When you get to the last file, or when all required fields are nonblank, you can write into your target file or take whatever steps are necessary.

Sample code, importing a json file with multiple records, each with two fields containing Airline Codes and Airline Names:

      BEG READ --- RAWJSON                HOLD 0 KEY IS  RAWJSON SNO
      IF       --- RAWJSON PATH               EQ     /data/AirlineCode
T     SET      SYS AIRLINE CODE               =  --- RAWJSON VALUE
      IF       --- RAWJSON PATH               EQ     /data/AirlineName
T     SET      SYS AIRLINE NAME               =  --- RAWJSON VALUE
T     WRITE    SYS AIRLINE                FAIL 0
      END READ --- RAWJSON

Here's a curl statement that will work to call that subroutine, assuming the subroutine is connected in Data Services to the name "SampleAPI":

curl -H "Content-Type: application/json" --data-binary @/airlineinfo.json https://serverURL.com/api/SampleAPI
 

Comments


<--/commentPlugin-->
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback