Share via

Create Shareable Link

Udai Goyal 6 Reputation points
2022-07-30T12:18:06.62+00:00

Hi Support,
I am trying to get the shareable link through /drive/items/{Item-ID}/createLink.
But when i am calling the api then i am getting "The request entity's media type 'application/x-www-form-urlencoded' is not supported for this resource."
error message, please help us to solve this error. Below is the method calling code of swift, please check and help.

var BearerToken = "Bearer (accessToken)"

request.httpMethod = "POST"
request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
request.setValue("application/json", forHTTPHeaderField: "Accept")
let requestDictionary: [String: Any] = ["type": "view"]
do {
request.httpBody = try JSONSerialization.data(withJSONObject: requestDictionary, options: .prettyPrinted)
} catch let error {
print(error.localizedDescription)
return
}

    request.setValue(BearerToken, forHTTPHeaderField: "Authorization")
Microsoft Security | Microsoft Graph

1 answer

Sort by: Most helpful
  1. HarmeetSingh7172 4,831 Reputation points
    2022-08-17T15:28:04.313+00:00

    Hi @Udai Goyal

    Hope you're doing well.

    Per my research and testing, Create Sharing Link Graph API is working fine when tested in an API client like Postman.

    232112-capture1.png

    As you are using Swift Code for Graph API, I would advise you to raise a case with GitHub Team.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.