API requests: SID not working - error 1007

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • API requests: SID not working - error 1007

    Hello,

    I am running api requests to a palo 2.0 server, everthing installed locally. However, it is not working. I can get an SID but I cannot use it. I even cannot logout.

    Here is an example of how I am trying to clear the demo/sales cube. I am assuming, that the SID has only 4 characters (!?) and I am using the default password that I found here in the forum:

    Sub PaloCubeClear()
    Dim HttpReq As New MSXML2.XMLHTTP40

    '****start sid****
    'get a session id
    Dim mySID As String
    HttpReq.Open "GET", "http://127.0.0.1:7777/server/login?user=admin&password=21232f297a57a5a743894a0e4a801fc3&sid=, False"
    HttpReq.send
    mySID = Left(HttpReq.responseText, 4)
    Debug.Print mySID
    '**** end sid****

    'clear the cube
    HttpReq.Open "GET", "http://127.0.0.1:7777/cube/clear?sid=rc67&database=DEMO&cube=Sales&complete=1 , False"
    HttpReq.send

    Debug.Print HttpReq.responseText
    Debug.Print HttpReq.responseBody
    Debug.Print HttpReq.getAllResponseHeaders
    End Sub


    These is the debugging information I get:
    rc67
    1007;"conversion failed";"error converting a string to a number, string has illegal characters";

    ???????????=????????????????????????????????????
    Server: Palo
    Content-Type: text/plain;charset=utf-8
    Content-Length: 97
    Connection: Keep-Alive


    If I simply want to logout, I also get an error:

    'login
    Sub PaloSID()
    Dim HttpReq As New MSXML2.XMLHTTP40
    HttpReq.Open "GET", "http://127.0.0.1:7777/server/login?user=admin&password=21232f297a57a5a743894a0e4a801fc3&sid=, False"
    HttpReq.send
    Debug.Print HttpReq.responseText
    Set HttpReq = Nothing
    End Sub

    'logout
    Sub PaloSIDLogout()
    Dim HttpReq As New MSXML2.XMLHTTP40
    HttpReq.Open "GET", "http://127.0.0.1:7777/server/logout?sid=rc67, False"
    HttpReq.send
    Debug.Print HttpReq.responseText
    Debug.Print HttpReq.responseBody, HttpReq.getAllResponseHeaders
    Set HttpReq = Nothing
    End Sub

    Debugging info:
    login:
    rc67;3600;
    ????? Content-Type: text/plain;charset=utf-8
    Content-Length: 10
    X-PALO-SV: 5426

    logout:
    1007;"conversion failed";"error decoding a base 64 value";

    ???????????=????????????????? Server: Palo
    Content-Type: text/plain;charset=utf-8
    Content-Length: 59
    Connection: Keep-Alive



    Requesting the SID works in Internet Explorer, all other commands do not work and show http 400 - error (something like: site found but the link is not correct).

    What is wrong here?

    regards

    arno

    The post was edited 1 time, last by cavallo ().

  • As describes in the API please use the index of the Database and the Cube instead of the Name.
    i.E.:

    to get the SID:
    "http://127.0.0.1:7779/server/login?sid=0000&user=admin&password=21232f297a57a5a743894a0e4a801fc3&sid="
    returns something like
    YmGs;3600;
    in the browser where YmGs ist the SID and 3600 the TTL

    after the login use
    "http://127.0.0.1:7779/server/databases?sid=YmGs"
    that will return lines like
    1;"Demo";27;28;1;0;18604;
    7;"SalesETLSQL";29;31;1;0;6484;

    the first number ist the number of the database
    if you type in
    "http://127.0.0.1:7779/database/cubes?sid=YmGs&database=1"
    you will get the numbers of the cubes like
    13;"Sales";6;12,6,2,4,8,10;3133440;264593;1;0;18604;
    34;"#views";2;29,31;0;0;1;0;18604;

    to clear a cube use
    "http://127.0.0.1:7779/cube/clear?sid=YmGs&database=1&cube=34&complete=1"
    output should be like
    34;"#views";2;29,31;0;0;1;0;18604;

    these are just the commands to use in a browser

    kind regards
    Enno

    The post was edited 1 time, last by Enno ().

  • Hello again,

    I still have some problems.

    With VBA (Excel) I cannot clear the cube again and again. This appears to work only if I get a new SID. In a browser, I always get a new SID, however, within Excel VBA I always get the same SID. I use

    server/login
    cube/clear
    and server/logout at the end but still I get the same SID.

    I have to close Excel and open it again. Maybe the connection is stored somewhere. However, there is no "close"-method available. There is "abort" but it does not help.

    For some reason "funcress"-addin is asking for a password in the background, I can see it when I close Excel. (...strange...)

    Pls. see the attachment if you like. In Excel VBA you will need to set a reference to "Microsoft XML V 5.0" to make it work. You can see the messages in the direct window. (Pls. note: The code works, but it clears the cube with one SID only once.) Help on MS XML is available in XMLSDK5.CHM that comes with Office 2003.

    regards

    arno
    Files
    • CubeClear.txt

      (1.52 kB, downloaded 527 times, last: )
  • Hi,

    I still could not find the trouble in my code. It always delivers the same SID, no matter if I already got a new one (created with the same link in a browser). Some data appears to be stored somewhere.

    As a workaround, I could create Excel files with auto_open events running the macros for each Cube using the SHELL command (starting excel with this file that will close the instance of excel).

    However, my solution so far is: As I always have to import the structures into the database from scratch, all related cubes will be empty (re. values) because the PALO.EADD-function with CLEAR=TRUE does that. So, I do not need the API at all.

    regards

    arno