Postman Testing and APIs

Hello everyone!

So, I uploaded various attachments to a page called “API_Test_1”. These attachments are pdf_1.pdf, pdf_2.pdf, and mp3_1.mp3 I’m trying to configure Postman to hit the page and retrieve data/attachments. After looking through the documentation, I managed to get an idea of how to use GET to retrieve some data–

I used GET for http://server:port/xwiki/rest and managed to get a 200 status which is good and provided some correct information.

However, when I attempted to access the page specifically as: http://server:port/xwiki/bin/view/Dashboard/API_Test_1/ I got a 404. Do I use params and put name then API_Test_1? How do I access the attachments as well?

I’m fairly new to both XWiki and APIs so any resources or advice you can provide is certainly welcomed.

EDIT: Given the information provided earlier in this post (the page I’m trying to get the attachments from is: http://server:port/xwiki/bin/view/Dashboard/API_Test_1/ ), what do we plug into here exactly?

/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/attachments[?start=offset&number=n]

  1. is Dashboard the wikiName or space name?
  2. What/where do I find what the nestedSpaceName is?
    3.I know API_Test_1 is my page name.
  3. Will I need any sort of code of access to access these resources?

Thank you for your time and patience!

Hi,

the great thing about the Xwiki API is that you really can navigate down the tree in postman just by clicking links. So starting from http://server:port/xwiki/rest/wikis/ you can just start clicking links until you reach http://server:port/xwiki/rest/wikis/xwiki/spaces/Dashboard/spaces/API_Test_1/pages/WebHome/attachments.

The above link also should answer all the questions about what is a space and what is a page.

Hope that helps.

Best regards

rbr

Rbr, Thank you for responding!! I managed to get everything going! Additionally, after going through all these API calls really helped give me a great a idea on whats considered a space, a page, and a wiki! My concern now is how I can properly get a PDF to show up in the body of the API call (kind of like how I can make a call to an MP3 attachment and be able to play the MP3 in the body of the API call).

Any and all suggestions and resources are welcomed!

Hi,

maybe I don’t get the question, but do you want to display the PDF or play the MP3 in postman?
I don’t think this is possible as postman is a development environment for REST-APIs/REST calls, not a document viewer or music player.

REST-APIs are normally used for scripting and machine to machine interactions. So maybe the REST-API is the wrong tool for the job?

Best regards,

rbr