MediaWiki API result

This is the HTML representation of the JSON format. HTML is good for debugging, but is unsuitable for application use.

Specify the format parameter to change the output format. To see the non-HTML representation of the JSON format, set format=json.

See the complete documentation, or the API help for more information.

{
    "batchcomplete": "",
    "continue": {
        "gapcontinue": "RecnumToRowID",
        "continue": "gapcontinue||"
    },
    "warnings": {
        "main": {
            "*": "Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes."
        },
        "revisions": {
            "*": "Because \"rvslots\" was not specified, a legacy format has been used for the output. This format is deprecated, and in the future the new format will always be used."
        }
    },
    "query": {
        "pages": {
            "595": {
                "pageid": 595,
                "ns": 0,
                "title": "Read and write files example",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "==Listing for the \"Read and write files example\" view:==\n\n(From the Unicorn blog post: [https://www.unicorninterglobal.com/company/blog/working-with-binary-files-in-dataflex Working with binary files in DataFlex])\n\n<source lang=\"vdf\">\nUse Windows.pkg\nUse DFClient.pkg\nUse cCharTranslate.pkg\nUse seq_chnl.pkg\nUse File_dlg.pkg\nUse cTextEdit.pkg\n\nDeferred_View Activate_oReadWriteFiles for ;\nObject oReadWriteFiles is a dbView\n\n    Set Border_Style to Border_Thick\n    Set Size to 155 533\n    Set Location to 1 2\n    Set Label to \"Read and write files example\"\n    \n    Property String  psMyFile\n    Property Integer piOldSize\n    \n    // This is what provides the means to encode/decode base64:\n    Object oTrans is a cCharTranslate\n    End_Object\n\n    // These two functions - ReadMyFile and WriteMyFile - are where the work\n    // gets done.\n    \n    Function ReadMyFile String sFilePathName Returns Boolean\n        Integer iChn\n        UChar[] ucaData\n        String  sFile\n        Boolean bExists\n        \n        // For timing test\n        DateTime dtStart dtEnd\n        Timespan tsDiff\n        \n        // Check file exists\n        File_Exist sFilePathName bExists\n        \n        If not bExists Begin\n            Send UserError ('File \"' + sFilePathName + '\" was not found') \"File not found\"\n            Function_Return False\n        End\n        \n        Get Seq_New_Channel to iChn\n        Direct_Input channel iChn (\"Binary:\" + sFilePathName)\n        \n        If not (SeqEof) Begin\n            \n            // Timing test\n            Move (CurrentDateTime()) to dtStart\n            \n            Read_Block channel iChn ucaData -1\n            Move (Base64EncodeUCharArray(oTrans(Self), ucaData)) to ucaData\n            Set_Argument_Size (SizeOfArray(ucaData) + 1)\n            Move (UCharArrayToString(ucaData)) to sFile\n\n            // Timeing test\n            Move (CurrentDateTime()) to dtEnd\n            Move (dtEnd - dtStart) to tsDiff\n//            Showln (\"Read: \" * String(SpanTotalMilliseconds(tsDiff)) + \"ms\")\n        End\n        Else Begin\n            Send UserError ('File \"' + sFilePathName + '\" does not exist or was empty') \"File Error\"\n            Function_Return False\n        End\n        \n        Close_Output channel iChn\n        Send Seq_Release_Channel iChn\n        Set psMyFile to sFile\n        \n        Function_Return True\n    End_Function\n\n    Function WriteMyFile String sFilePathName Returns Boolean\n        Integer iChn iPos iResp\n        UChar[] ucaFile\n        String  sPath sDir sFile\n        Boolean bExists\n        \n        // For timing test\n        DateTime dtStart dtEnd\n        Timespan tsDiff\n\n        Move (RightPos(\"\\\", sFilePathName)) to iPos\n        \n        If not iPos Begin\n            Send UserError \"Could not find folder\" \"Folder Error\"\n            Function_Return False\n        End\n        \n        Move (Left(sFilePathName, (iPos - 1))) to sPath\n        \n        File_Exist sPath bExists\n        \n        If not bExists Begin\n            Send UserError ('Folder \"' + sPath + '\" does not exist') \"Folder Error\"\n            Function_Return False\n        End\n        \n        Move (Right(sFilePathName, (Length(sFilePathName) - iPos))) to sFile\n        File_Exist sFilePathName bExists\n        \n        If bExists Begin\n            Move (Right(sFilePathName, (Length(sFilePathName) - iPos))) to sFile\n            Get YesNo_Box ;\n                ('The file \"' + sFile + '\" already exists in folder' * sPath + '. Do you wish to overwrite it?') ;\n                \"Overwrite file?\" to iResp\n                \n            If (iResp = MBR_NO) ;\n                Function_Return False\n        End\n                \n        Move (StringToUCharArray(psMyFile(Self))) to ucaFile\n        Move (Base64DecodeUCharArray(oTrans(Self), ucaFile)) to ucaFile\n        \n        // If some other program has the file open (and in some cases, has even\n        // previously had the file open), writing to it may fail, so we catch\n        // that error in order to deal with it ourselves and return \"failure\"\n        // rather \"success\", resetting it after the write operation, and use the\n        // ERR global indicator to detect the problem.\n        Send Ignore_Error of Error_Object_Id 32\n        Move False to Err\n        \n        // Timing test\n        Move (CurrentDateTime()) to dtStart\n\n        Get Seq_New_Channel to iChn\n        Direct_Output channel iChn (\"Binary:\" + sFilePathName)\n        Write channel iChn ucaFile\n        Close_Output channel iChn\n        Send Seq_Release_Channel iChn\n        Send Trap_Error of Error_Object_Id 32\n        \n        // Timing test\n        Move (CurrentDateTime()) to dtEnd\n        Move (dtEnd - dtStart) to tsDiff\n//        Showln (\"Write:\" * String(SpanTotalMilliseconds(tsDiff)) + \"ms\")\n        \n        If (Err) Begin\n            Send UserError ('There was an error writing to file \"' + sFilePathName + '\"') \"Write Error\"\n            Function_Return False\n        End\n        \n        Function_Return True\n    End_Function\n    \n    // The user interface...\n    \n    Object oOpenDialog is a OpenDialog\n    End_Object\n\n    Object oSaveAsDialog is a SaveAsDialog\n    End_Object\n    \n    Object oRead is a Form\n        Set Size to 13 390\n        Set Location to 3 86\n        Set Label to \"File path-name to read:\"\n        Set psToolTip to \"File path-name to read\"\n        Set Label_Justification_Mode to JMode_Right\n        Set Label_Col_Offset to 2\n        Set Value to ;\n            \"C:\\Program Files (x86)\\DataFlex 19.1\\Documentation\\Installation_and_Environment_Guide.pdf\"\n        Set Prompt_Button_Mode to PB_PromptOn\n        Set peAnchors to anTopLeftRight\n        \n        Procedure Prompt\n            Boolean bOK\n            String  sFile\n            \n            Get Show_Dialog of oOpenDialog      to bOK\n            \n            If bOK Begin\n                Get File_Name of oOpenDialog    to sFile\n                Set Value                       to sFile\n            End\n            \n        End_Procedure\n        \n    End_Object\n\n    Object oDoRead is a Button\n        Set Size to 14 47\n        Set Location to 3 480\n        Set Label to \"Read file\"\n        Set peAnchors to anTopRight\n    \n        Procedure OnClick\n            String  sFile\n            Boolean bOK\n            Integer iOldSize iNewSize\n            \n            Get_Argument_Size                   to iOldSize\n            Set piOldSize                       to iOldSize\n            Set Value of oBase64File            to \"\"\n            \n            Get Value of oRead   to sFile\n            Get ReadMyFile sFile to bOK\n            \n            Set Enabled_State of oWrite         to bOK\n            Set Enabled_State of oDoWrite       to bOK\n            \n            If bOK Begin\n                Get_Argument_Size               to iNewSize\n                Set piMaxChars of oBase64File   to iNewSize\n                Set Value of oBase64File to (If(bOK, psMyFile(Self), \"\"))\n            End\n            Else Begin\n                Set_Argument_Size (piOldSize(Self))\n                Set piMaxChars of oBase64File   to (piOldSize(Self))\n            End\n            \n            Send Info_Box ('File \"' + sFile + ;\n                If(bOK, '\" was read successfully', '\" could not be read')) ;\n                (If(bOK, \"Success\", \"Failure\"))            \n        End_Procedure\n    \n    End_Object\n\n    Object oWrite is a Form\n        Set Size to 13 390\n        Set Location to 20 86\n        Set Label to \"File path-name to write:\"\n        Set Label_Justification_Mode to JMode_Right\n        Set Label_Col_Offset to 2\n        Set Enabled_State to False\n        Set Value to \"C:\\Temp\\MyTestFile.pdf\"\n        Set Prompt_Button_Mode to PB_PromptOn\n        Set peAnchors to anTopLeftRight\n                \n        Procedure Prompt\n            Boolean bOK\n            String  sFile\n            \n            Get Show_Dialog of oSaveAsDialog    to bOK\n            \n            If bOK Begin\n                Get File_Name of oSaveAsDialog  to sFile\n                Set Value                       to sFile\n            End\n            \n        End_Procedure\n        \n    End_Object\n\n    Object oDoWrite is a Button\n        Set Size to 14 47\n        Set Location to 20 480\n        Set Label to \"Write file\"\n        Set Enabled_State to False\n        Set peAnchors to anTopRight\n    \n        Procedure OnClick\n            String  sFile\n            Boolean bOK\n            \n            Get Value of oWrite                 to sFile\n            \n            If (sFile = \"\") Begin\n                Send Info_Box \"You must enter a file path and name to write to\" \"Enter Filepath\"\n                Procedure_Return\n            End\n            \n            Get WriteMyFile sFile               to bOK\n            \n            Set Enabled_State of oWrite         to (not(bOK))\n            Set Enabled_State of oDoWrite       to (not(bOK))\n            \n            If bOK Begin\n                Set Value of oBase64File        to \"\"\n                Set psMyFile                    to \"\"\n                Set_Argument_Size (piOldSize(Self))\n                Set piMaxChars of oBase64File   to (piOldSize(Self))\n            End\n            \n            Send Info_Box ('File \"' + sFile + ;\n                     If(bOK, '\" was written successfully', '\" was not written')) ;\n                    (If(bOK, \"Success\", \"Failure\"))\n        End_Procedure\n    \n    End_Object\n\n    Object oBase64File is a cTextEdit\n        Set Size to 101 520\n        Set Location to 46 6\n        Set Read_Only_State to True\n        Set Label to \"Base64 Encoded File (will be gibberish... unless vous parlez base64!):\"\n        Set peAnchors to anAll\n    End_Object\n\nCD_End_Object\n\n</source>"
                    }
                ]
            },
            "241": {
                "pageid": 241,
                "ns": 0,
                "title": "Recent Additions",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "These are the 10 most recently added pages on DataFlex.wiki:\n\n{{Special:Newestpages/-/10}}\n\nTo see the 50 most recently added pages, go to [[Special:NewestPages|Newest Pages]]"
                    }
                ]
            }
        }
    }
}