Skip to main content

[CPANEL-32041] cpanel api oddities

Comments

10 comments

  • cPanelLauren
    Yea, I'm able to replicate that inconsistency as well: [root@server ipv4]# whmapi1 listaccts search=mydomain.us searchtype=domain want=domain --- data: acct: - domain: mydomain.us has_backup: 0 - domain: demo.mydomain.us has_backup: 0 - domain: aliastest.mydomain.us has_backup: 0 metadata: command: listaccts reason: OK result: 1 version: 1
    [root@server ipv4]# whmapi1 listaccts search=mydomain.us searchtype=domain want=domain,user --- data: acct: - domain: mydomain.us has_backup: 1 user: lauren - domain: demo.mydomain.us has_backup: 1 user: demomydomain - domain: aliastest.mydomain.us has_backup: 1 user: aliasmydomain metadata: command: listaccts reason: OK result: 1 version: 1
    Not only is the backup information inconsistent but I didn't ask for that parameter to be returned, as you noticed as well. I'll look through our cases to see if I can find anything on this and if not I'll get a new one opened for it and update this thread once I've done that. Thanks for pointing that out :)
    0
  • cPanelLauren
    Hi @ca2236 I've opened CPANEL-32041 - whmapi1 listaccts 'want' parameter includes has_backup return with inconsistent results for this issue. I'll update here with any further information on it as I get it.
    0
  • ca2236
    Thanks! on a side note with this topic. Is there a way to only return a True/False answer for a pattern match? (or excluded metadata)? also, another oddity with this: If I search for a domain that doesn't match, it only shows metadata, but I would expect result to be '0' for no matches, if this is what it means. Please see below: Note: I'm searching for a domain that doesn't exist on my server, yet the results show a value of '1' as if a match was found (as I understand it) # /usr/local/cpanel/bin/whmapi1 listaccts search=test2.domain.com searchtype=domain want=domain --- metadata: command: listaccts reason: OK result: 1 version: 1
    Subsequent tests are the same if want is removed. If I remove searchtype, I get all kinds of random output not matching the search parameter. Result always? seems to be '1' so maybe this doesn't mean how many results are found? This might be true since did a search for a domain that resulted in multiple matches and result is always '1'. thanks for your help :)
    0
  • cPanelLauren
    on a side note with this topic. Is there a way to only return a True/False answer for a pattern match? (or excluded metadata)?

    I think that depends on the return you're looking to get the True/False answer to.
    Subsequent tests are the same if want is removed. If I remove searchtype, I get all kinds of random output not matching the search parameter. Result always? seems to be '1' so maybe this doesn't mean how many results are found? This might be true since did a search for a domain that resulted in multiple matches and result is always '1'.

    I agree the output is confusing and seems inconsistent. I tried this as well with different parameters. You'd think that you'd return a 0 here for the parameters you've included in wants at the very least. I think the entire issue is related to the wants parameter and I'd like to see what development says about the case I opened as well. This thread is linked to it so they are able to reference this thread when necessary.
    0
  • ca2236
    thanks!
    0
  • ca2236
    Hi, Is there any updates on this? I noticed it still an issue
    0
  • cPRex Jurassic Moderator
    I checked the case just now and I don't see any updates at this time. I did test this command on my end just now and I'm not seeing the has_backup option being listed: # whmapi1 listaccts search=domain.com searchtype=domain want=domain --- data: acct: - domain: domain.com metadata: command: listaccts reason: OK result: 1 version: 1 # whmapi1 listaccts search=domain.com searchtype=domain want=domain,user --- data: acct: - domain: domain.com user: amps metadata: command: listaccts reason: OK result: 1 version: 1
    That test was run on a version 98 system - can you let me know what version you're using at this time?
    0
  • cPRex Jurassic Moderator
    Ah, I do see that searching for a non-existent domain is still happening though. I've updated the case to let them know you asked about it, and I'll post updates if I hear back.
    0
  • ca2236
    Oops. I think I reopened the wrong bug, I can create a new ticket. I was thinking this was one where it shows a result=1 even if you use listaccts api and it returns no matches for domain. But the result still shows 1. the result 1 could be true or number of results, so maybe I am misunderstanding that. But either way, should it be 0 (if it means true/false) for no results?
    0
  • cPRex Jurassic Moderator
    Nope, you had the correct thread, I just tested wrong on my end! I clarified that test with my second post, above.
    0

Please sign in to leave a comment.