AzureDevOps - Issue with Wiki REST API - azure-devops-rest-api

I'm facing an issue with the API of the Wiki in AzureDevops...
Basically, I need to update some pages available there and I'm receiving an error 404.
My Wiki link is something like:
https://dev.azure.com/{company}/{project}/_wiki/wikis/{MY_REPO_NAME}.wiki/1234/My_page
And when I try to retrieve the content of this page trough Postman I use the address:
https://dev.azure.com/{company}/{project}/_apis/wiki/wikis/{MY_REPO_NAME}.wiki/pages?path=/1234/My_page&includeContent=True&api-version=5.0
But I'm receiving a message with 404:
{
"$id": "1",
"innerException": null,
"message": "Wiki page ‘/1234/My_page’ could not be found. Ensure that the path of the page is correct and the page exists.",
"typeName": "Microsoft.TeamFoundation.Wiki.Server.WikiPageNotFoundException, Microsoft.TeamFoundation.Wiki.Server",
"typeKey": "WikiPageNotFoundException",
"errorCode": 0,
"eventId": 3000
}
I think I'm missing the part of the {WikiIdentifier} that is available here https://learn.microsoft.com/pt-br/rest/api/azure/devops/wiki/pages/get?view=azure-devops-rest-5.0#get-page-as-json-with-content but I'm not sure...
Anyway, any idea here?
Thank you very much, guys!

I just found how to solve this... just to make sure no know will suffer this, I was able to execute the GET and other verbs of that endpoint using the encoding code %2F. For example:
https://dev.azure.com/{company}/{project}/_apis/wiki/wikis/{MY_REPO_NAME}.wiki/pages?path=%2F1234/My_page&includeContent=True&api-version=5.0
Another item, if you used a space in the title of the wiki's page, remember to replace the space by %20.

Related

Get an Auth code from ms graph for an application - returning error about missing request_type

I am creating a Power Automate flow to get MS Booking information. Having trouble with getting an Authorization using https://login.microsoftonline.com/***TENANT ID****/oauth2/token. I receive an error that I am missing grant_type although I supply it. I registered the app in azure, the HTTP request in power automate looks like this:
{
"uri": "https://login.microsoftonline.com//oauth2/token",
"method": "POST",
"headers": {
"content-type ": "application/x-www-form-urlencoded"
},
"body": "client_id=&resource=https://graph.microsoft.com&grant_type=password&client_secret=&username=username&password=password"
I receive the error:
{"error":"invalid_request","error_description":"AADSTS900144: The request body must contain the following parameter: 'grant_type'.
Anyone have an idea what I am doing wrong or missing? Thank you in advance.
Just a quick follow-up. Thanks Expiscornpvus, you pointed me in the right direction, although there were spaces after the content type header, I corrected this and things worked well

YouTube Data API V3 unkownPart "localizations"

I have been trying to fetch all videos from a playlist using YouTube Data API, which worked like a char; next, I wanted to try and filter videos based on languages, so I wanted to try to include the "localizations" part. However, whenever I do, I get a 400 response stating that "localizations" is "unkownPart". From what I could see in the documentation, I should have my GET request structured properly:
`https://youtube.googleapis.com/youtube/v3/playlistItems?part=localizations&part=snippet&maxResults=${limit}&playlistId=${playlistId}&key=${apiKey}`
Error message in postman:
{
"error": {
"code": 400,
"message": "'localizations'",
"errors": [
{
"message": "'localizations'",
"domain": "youtube.part",
"reason": "unknownPart",
"location": "part",
"locationType": "parameter"
}
]
}
}
"localizations" is a direct copy from the documentation. The GET request works fine if I remove it so I'm confident that the problem is either the order or my parameters, or the combinations of parameters in use (though I couldn't find anything about incompatible parameters in the documentation).
Parameters order goes as follows:
localizations
snippet
playlistId
key
EDIT: link to the documentation: https://developers.google.com/youtube/v3/docs/playlists/list
After sending the Issue Report it was discovered that I had been using the wrong API endpoint. Somehow (I can't remember why) I was using the "playlistItem" endpoint which doesn't support "localizations", and needed to shift to using the "playlists" endpoint instead.
Furthermore when using a combination of both "snippet" and "localization", they should be within the same parameter but comma-separated, however, Postman doesn't auto-convert the commas in the parameters to "%2C" and therefore would cause further trouble understanding the requests. Fixing these 2 steps, it now works as intended.

issue with Microsoft graph api with forward slashes "/" in /me/events/{id}

I am having a similar issue to the post described here.
How to get an event ID from the HitID returned by a Microsoft Graph search query?
In my case I am not trying to do a patch, but just a lookup via the v1.0/me/events/{id} get request. I am using the search API of Microsoft graph API. It returns me a HitId with forward slashes in it. I tried to resolve it in the exact same way as the post describes, but cant seem to get it to work. My id parameter is:
AAMkADgwZjlhNmJjLWNiMGQtNGE5MS1hMDVkLTNkNTU2ZWE5ZmM5ZgBGAAAAAAAjq0f6CrWJSoJ6oKcYbrJfBwAyr2CWzX9CSrX7fgfr1AFOAAAAAAENAAAyr2CWzX9CSrX7fgfr1AFOAAV/rENQAAA=
I replaced the / with %252F and the call still fails. The new request id is:
AAMkADgwZjlhNmJjLWNiMGQtNGE5MS1hMDVkLTNkNTU2ZWE5ZmM5ZgBGAAAAAAAjq0f6CrWJSoJ6oKcYbrJfBwAyr2CWzX9CSrX7fgfr1AFOAAAAAAENAAAyr2CWzX9CSrX7fgfr1AFOAAV%252FrENQAAA=
which still fails in exactly the same way. To isolate the problem I used Microsoft Graph API explorer to test the request, which returns the following error message
{
"error": {
"code": "RequestBroker--ParseUri",
"message": "Resource not found for the segment 'rENQAAA='.",
"innerError": {
"date": "2021-03-18T07:48:24",
"request-id": "83cecc8b-f510-4cf0-b5f1-e4cd5f09e223",
"client-request-id": "530677e9-fa2d-a842-149e-a8db4939f3b8"
}
}
}
I cant seem to find any suitable documentation on how to resolve the issue.
Thanks in advance for any help.
Where ever you get / simply replace it with -. This will resolve your issue.

How to patch the localPost except for summary using GMB API?

I would like to know how we can edit localPost except for summary.
I created the request like following.
URL: https://mybusiness.googleapis.com/v4/accounts/23432/locations/23423/localPosts/23432?updateMask=summary&updateMask=title
Request body
{
"summary": "AAAA",
"event": {
"title": "TEST TITLE"
}
}
However, I can only edit summary, not the other field.
I tried following requet URLs as well.
https://mybusiness.googleapis.com/v4/accounts/23432/locations/23423/localPosts/23432?updateMask=summary,title
https://mybusiness.googleapis.com/v4/accounts/23432/locations/23423/localPosts/23432?updateMask=title
But, GMB API response dose not give me any error.
So, it looks like fine.
Do have you have any idea for this?
Best regards,
Here's how you should chain your parameters:
?updateMask=summary,event.title

Making a simple authorized request to eBay

I'm planning to integrate a website with eBay using PHP, but first I'm using Postman to test everything.
Authorization took me an entire day, but I think I've got it working now. (I had to update to the latest version of Postman, then I got it to create a token for me.)
I say I think because I haven't managed to get a single request to work. I deliberately chose bulkGetInventoryItem (documentation) as it seemed like one of the easier authorized requests to get working. I just know that when the authentication settings are wrong, I get a different error message to when they are right.
For troubleshooting reasons, I made a token with all the scopes:
https://api.ebay.com/oauth/api_scope
https://api.ebay.com/oauth/api_scope/sell.marketing
https://api.ebay.com/oauth/api_scope/sell.inventory
https://api.ebay.com/oauth/api_scope/sell.account
https://api.ebay.com/oauth/api_scope/sell.fulfillment
https://api.ebay.com/oauth/api_scope/sell.finances
https://api.ebay.com/oauth/api_scope/sell.payment.dispute
https://api.ebay.com/oauth/api_scope/commerce.identity.readonly
(added as space-separated list of links)
I have changed one of the eBay listings to have an SKU of "123456" just for this test, however the error I get is exactly the same as if I change "sku": "123456" to "sku": "anObviouslyFakeSKU", but anything else I change creates a new error, so I'm suspecting the issue to be SKU related, but maybe it isn't. (I've found the eBay API to be very poor at sending relevant error messages.)
I'm quite new to Postman, so it's likely a rookie mistake.
Earlier errors have shown to be minor punctuation issues or wrong radio buttons ticked, so hopefully whatever the error is this time, it should appear in this screenshot.
What did I do wrong this time? (Let me know if there are any other screenshots I can send that might help.)
To help, both with the post's SEO, and ease of copy/pasting, I am transcribing the important text in the screenshot above:
url
POST https://api.ebay.com/sell/inventory/v1/bulk_get_inventory_item
body, raw
{
"requests": [
{
"sku": "123456"
}
]
}
output
{
"errors": [
{
"errorId": 2003,
"domain": "ACCESS",
"category": "APPLICATION",
"message": "Internal error",
"longMessage": "There was a problem with an eBay internal system or process. Contact eBay developer support for assistance",
"parameters": [
{
"name": "reason",
"value": "Failed to transform underlying error response, see logs."
}
]
}
]
}
Update:
One more screenshot
Update 2:
Another screenshot
A few things you need to check for in Postman.
When you authenticate and receive a token are you posting that token with your api calls like this one POST https://api.ebay.com/sell/inventory/v1/bulk_get_inventory_item?
Have you set the Authorization HTTP header for authentication authorization?
Have you set the Content-Type header for the call to application/json?
More info here: https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/bulkGetInventoryItem
Update
Authorization with environment variable in Postman:
Postman environment variables documentation:
https://learning.postman.com/docs/postman/variables-and-environments/variables/
I figured out the issue. My biggest mistake was choosing bulkGetInventoryItem as the "simplest" call. I should have chosen getInventoryItem, as the error reporting on that function is far more user friendly.
So the error I got, for exactly the same request was "We didn't find the entity you are requesting. Please verify the request"
A quick google of the error found me this page https://forums.developer.ebay.com/questions/17883/cannot-get-my-listed-product-by-get-inventory-api.html which led me to the correct answer!
The inventory item I was trying to access was unreachable because it was not created through the developer API.
I hope this answer helps others, as it wasted a full day of my life trying getInventoryItem before tackling bulkGetInventoryItem.

Resources