Code Monkey home page Code Monkey logo

Comments (3)

brianbunke avatar brianbunke commented on May 23, 2024 1

And also to add, if that ^ is actually the problem you're running into, do this instead:

Get-WikiPage -Title somepage -SpaceKey somespacekey -Limit 100 | Select -First n

from confluenceps.

ScottWelker avatar ScottWelker commented on May 23, 2024 1

You've understood completely. I like that last "do this instead". Thank you!

I really appreciate your sharing this. I had to work directly with the Confluence v3.x REST API. ConfluencePS is saving me a bunch of work - for the Confluence v5.x REST API.

Thanks again!!

from confluenceps.

brianbunke avatar brianbunke commented on May 23, 2024

Thanks man! This helped me realize I haven't yet added ValidateRange on the [int] parameters, so I appreciate the feedback!

I think you're running into an API problem I haven't been able to "hide" at this point. Here's what your command is actually doing, in order:

Get-WikiPage -Title somepage -SpaceKey somespacekey -Limit n

  1. Build the URI:
    • https://wiki.contoso.com/rest/api/content?type=page&spaceKey=somespacekey&limit=n
    • Note that it's ignoring the Title parameter so far
  2. Makes the REST Get call with that URI and your credentials
  3. Uses Where-Object to filter down to Title wildcard matches

This is the part that matters: Inside the space key you supply, it grabs the first n results at random.1 If the first four random results don't match your Title string, they are all filtered out as part of step 3, and then it appears to fail silently.

I have two options here:

  1. Keep it this way. Hopefully not everyone runs into the same problem 😢
    • Maybe I can review the help I wrote for Get-WikiPage and be more explicit about this?
  2. Go back to adding the Title parameter in step 1, BUT:
    • From memory, this makes it case sensitive (like SpaceKey is currently)
    • and I'm pretty sure it also breaks wildcarding

I hated those downsides in option 2, so I went the option 1 route during creation.

Let me know if that makes sense, or please tell me if I misunderstood your problem completely, haha.

1 Random as far as I can tell, anyway. I'm sure there's some rhyme or reason, but I haven't figured it out.

from confluenceps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.