I want to CURL an API to get the contents of a confluence page using the pagename. I have an API to get the page details via pageid.
curl -u <userid>:<password> -X GET confluence-url/confluence/rest/prototype/1/content/<pageid>
But i want an API to get the same via pagename. Is that possible?
Check out confluence rest api examples
Maybe you are looking for something like this:
curl -u admin:admin -X GET "http://localhost:8080/confluence/rest/api/content?title=myPage%20Title&spaceKey=TST&expand=body.storage"
EDIT:
"title" is the name of the page
"spaceKey" is the key for your space. Confluence is organized in spaces. You can read more about spaces here
Expansions are documented here. expand specifies which elements should be expanded in the response. as stated in the documentation
If your GET returns a list of results and you don't choose to expand anything, the response is terse, displaying only a basic representation of the resource. It will, however, include a list of the expandable items for the resource.
So if you want the response to include the content of your page, then you need to expand "body.storage". If you want to expand multiple things you can seperate them with comma.
Related
currently im working on a project for university. The goal is to make api calls with cmd (Curl) and transfer the data into a bi tool. I dont have any experience with coding/scripting and so on. The problem i currently have is that a single api call brings back 100 resources but i need all of the Data to visualize it.
curl -X get "https://(url)" -H "accept: application/json" -H "authorization: Basic (Username:Password) --proxy () --output () --output-dir ()
So my goal here is to create like a loop so that all of the data ist getting saved in one file.
Any Ideas?
Thank you !
Either it is in the API documentation how to get all the pages or there are Range headers or there are Link headers or hyperlinks attached to the response body for the next/previous pages or there is a MIME type e.g. JSON-LD, HTML, XML, etc. you can request with Accept header which contains hyperlinks. Without knowing the exact API it is not possible to tell which implementation the API developers chose. Maybe they were lazy and neither of them.
I am making an android application which lists trending songs. I am fetching the song details through the LastFM API. The API method I use is http://ws.audioscrobbler.com/2.0/?method=track.getInfo&api_key=YOUR_API_KEY&artist=cher&track=believe&format=json
However, this doesn't give me a link to YouTube like how LastFM does on their website. Is there any way for me to replicate that functionality? Am I supposed to use another API method that I don't know of or should i rely on something else entirely?
I did some amount of searching and I came across http://downloadmarkt.be/lastfm-musicengine/example-search.php In the search results, the YouTube links are also displayed. How is the developer achieving this?
There are no direct links to youtube videos in the last.fm API.
The website you posted searches the links directly on youtube and not on last.fm (see the javascript at the bottom of that script file).
Best solution that I've found: you do get a page song url in the last.fm API response,
<url>
https://www.last.fm/music/Anathema/_/Fragile+Dreams
</url>
That page contains the youtube url. If you open the html page, you'll see something like this in there
data-youtube-id="CsHYSvlsDWw"
data-youtube-url="https://www.youtube.com/watch?v=CsHYSvlsDWw"
Use your favorite method for parsing webpages to get that info,
$ curl -sL https://www.last.fm/music/Anathema/_/Fragile+Dreams |
hxnormalize -x 2> /dev/null |
hxselect -s '\n' -c 'a::attr(data-youtube-id) |
uniq
$ CsHYSvlsDWw
that is, you get the page, you get rid of any inconsistencies and then you select the data-youtube-id. You need to add a new line between the matches, since there seems to be two such entries on the page. Last step, you take one of the two similar results (the uniq part at then end).
Happy hacking.
I'll get this out of the way first: I'm an amateur programmer (at best)...i have some knowledge of how APIs work, but little to no experience manipulating the podio API directly (ie I use zapier/globiflow a lot and don't write any php/ruby). I'm sure other people can figure this out via the API documentation, but I can't. So i'm really hoping someone can help clarify and give some more detailed instruction.
My Overall objective:
I frequently export podio files as xlsx from the podio front-end. This is used by my team and me to do regular data analysis tasks in excel. I would like to make this process easier by automating the function of getting an updated podio export into my excel. My plan is to do this via excel VBA. I understand from other searching that it is possible to send an HTTP request using VBA, so i want to make sure i understand what I need to send to the Podio API to get what I need. The method of how to write the HTTP request in excel VBA is outside the intentional scope of this question (though i'd accept any help on this!)
What I've tried so far:
I know that 'get items as xlsx' is part of the podio API: https://developers.podio.com/doc/items/get-items-as-xlsx-63233
However I cannot seem to get this to work in the sandbox environment on that page so that i can figure out a valid request url. I get this message: 'Invalid filtering key' ... because i have no idea how to fill in that field. The information on that page is not clear on this. Nor is it evident on the referenced 'views page'. There are no examples to follow!
I don't even want to do any filtering. I just want to get ALL items in the app. Or i can give it a pre-existing view_id, but that doens't seem to work either without a {key}
I realise this is probably dead simple. Please help a noob? :)
Unfortunately, the interactive API sandbox does not behave appropriately for this particular endpoint. For filtering, this API endpoint expects query string parameters where the field-value pairs consist of integer field IDs and the allowed values for each field. Filtering by fields is totally optional. It looks like this sandbox page isn't built for this kind of operation with dynamic query string field names; wherever you see the {key} field on that page is meant as a placeholder for whatever field IDs that you would use for filtering.
If you want to experiment with this endpoint, I would encourage you to try another dedicated HTTP client first. I was able to get this simple example working with the command-line program wget:
wget --header="Authorization:OAuth2 $MY_SECRET_TOKEN" \
--content-disposition \
"https://api.podio.com/item/app/16476850/xlsx/"
In this case, wget downloaded an Excel file containing all the items in my app without any filtering applied. The additional --content-disposition argument tells wget to save the output as a file with a name using the information in the server's Content-Disposition response header.
With a filter applied:
wget --header="Authorization:OAuth2 $MY_SECRET_TOKEN" \
--content-disposition \
"https://api.podio.com/item/app/16476850/xlsx/?130654431=galaxy"
In this case, the downloaded file filtered the results to items where field id 130654431 (which is a category field) contain the value galaxy.
I am using the following command to add tags via the Asana API.
curl -u '<api_key>' https://app.asana.com/api/1.0/tags -d "name=testing" -d "workspace=15601112094251"
I even get a successful JSON reply with the created tag object. However, I never actually see the tag inside Asana. I also do not see the tag when listing all tags for my workspace.
When I query for the tags specifically by ID, I do see it though.
Bug on Asana's side? Or am I doing something wrong?
See https://stackoverflow.com/a/24873988/254896 - because of the way the data model works, tags that aren't assigned to anything are hidden.
I have a Google spreadsheet published to the web, and I'm trying to read and write list-based feeds. I have not authenticated.
I can read data using a GET request just fine.
curl https://spreadsheets.google.com/feeds/list/1WngGKZHauwBqRxgC5E6DFMiJ-J8BDsadfwerF4RE0M/1/public/full
However, all my post requests to write data come back with an error
curl --data '' https://spreadsheets.google.com/feeds/list/1WngGKZHauwBqRxgC5E6DFMiJ-J8BDlN3mMaBfF4RE0M/1/public/full
curl --data '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gsx="http://schemas.google.com/spreadsheets/2006/extended"><gsx:id>1</gsx:id><gsx:status>1</gsx:status><gsx:user_email>1</gsx:user_email><gsx:url domain>1</gsx:url domain><gsx:highlighted_text>1</gsx:highlighted_text><gsx:complete_text comments>1</gsx:complete_text comments><gsx:created_date>1</gsx:created_date><gsx:updated_date>1</gsx:updated_date><gsx:created_by>1</gsx:created_by><gsx:updated_by>1</gsx:updated_by></entry>' https://spreadsheets.google.com/feeds/list/1WngGKZHauwBqRxgC5E6DFMiJ-J8BDlN3mMaBfF4RE0M/1/public/full
The error I'm getting is: "Sorry, the file you have requested does not exist. Please check the address and try again."
Do POST request require authentication? I can't find anything in the docs that say so.
Any help would be appreciated. Thanks.
Two things:
I think you need to use the private feed (.../private/full), not the public one (.../public/full) like you're using now. More on the private-versus-public distinction is in the API docs.
You will need an Authorization header. (That process gets pretty complicated, but there's a lot of good info here. Remember to select the appropriate scopes.)
Both are mentioned in the example about adding a list row in the Sheets API docs. (I'd link directly, but I don't have enough rep to add more than two links. Just search for "Adding a list row".)