cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nahcyrret
Helper II
Helper II

Send an HTTP request to SharePoint for link with 401 Unauthorized

splink1.png

splink2.png

 I am not sure if the above update for SharePoint link with alternative text (Description) above is correct or not. Anyway, it got the 401 unauthorized error. How to solve this problem?

2 ACCEPTED SOLUTIONS

Accepted Solutions

@nahcyrret see quote around Incident. Have you copy paste from notepad/word? 

Hardesh15_0-1659595575054.png

See the difference-

Hardesh15_1-1659595633326.png

Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

@Hardesh /Gopenly.in

 

View solution in original post

@nahcyrret Your _metadata tag is incorrect. it should be __metadata (here two underscore)

Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

@Hardesh /Gopenly.in

 

 

View solution in original post

11 REPLIES 11
Hardesh15
Super User
Super User

@nahcyrret Pls share full content of http body. Also share column name from SharePoint List. if possible share screens.

Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

@Hardesh /Gopenly.in

INPUTS

{
"_metadata": {
"type": "SP.Data.Incidents.ListItem"
},
"Link": {
"Description": "INC251499",
"Url": "https://.../nav_to.do?uri=incident.do%3Fsys_id=ca153756db0d1190e504df0bd396197c%26sysparm_stack=incident_list.do%3Fsysparm_query=active=true"
}
}

OUTPUTS

{
  "status"401,
  "message""401 UNAUTHORIZED\r\nclientRequestId: 6ea9a978-7ab0-45ab-9cdd-280216f354d6\r\nserviceRequestId: e59357a0-00b0-1000-72b9-e3fd253e1a90",
  "source""https://.../sites/ITS-UserServices/api/lists/getbytitle(%E2%80%98Incidents%E2%80%99)/items(32)",
  "errors": []
}
Link.PNGA

 I just want to write the Link field with alternative text with the Description above. Is it correct? Also, I am the owner of the site with the Incidents list. The flow runs under my account in power automate.

@nahcyrret Check these two-

1. "source""https://.../sites/ITS-UserServices/api/lists/getbytitle(%E2%80%98Incidents%E2%80%99)/items(32)",

quote around Incident?

2. "Url": "https://.../nav_to.do?uri=incident.do%3Fsys_id=ca153756db0d1190e504df0bd396197c%26sysparm_stack=incident_list.do%3Fsysparm_query=active=true"

Are you able to access URL?

Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

@Hardesh /Gopenly.in

1. The SharePoint list name is Incidents.

2. I am able to access the URL.

@nahcyrret see quote around Incident. Have you copy paste from notepad/word? 

Hardesh15_0-1659595575054.png

See the difference-

Hardesh15_1-1659595633326.png

Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

@Hardesh /Gopenly.in

 

httprequest.png

Is there anything wrong? Do I need to remove the quote around Incidents?

@nahcyrret  Pls test your flow.

Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

@Hardesh /Gopenly.in

INPUTS

{
"_metadata": {
"type": "SP.Data.Incidents.ListItem"
},
"Link": {
"Description": "INC251309",
"Url": "https://.../nav_to.do?uri=incident.do%3Fsys_id=11151b71db499d50446c2e1fd396195c%26sysparm_stack=incident_list.do%3Fsysparm_query=active=true"
}
}

OUTPUTS

{
  "status"400,
  "message""The property '_metadata' does not exist on type 'SP.Data.IncidentsListItem'. Make sure to only use property names that are defined by the type.\r\nclientRequestId: 70db870d-046a-4c6d-b72c-3145abe9185b\r\nserviceRequestId: 4ee757a0-603f-1000-72b9-e1ecaf12a6c6",
  "source""https://.../sites/ITS-UserServices/_api/lists/getbytitle('Incidents')/items(38)",
  "errors": [
    "-1",
    "Microsoft.SharePoint.Client.InvalidClientQueryException"
  ]
}
 
Now, the error changed as above.

@nahcyrret Your _metadata tag is incorrect. it should be __metadata (here two underscore)

Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

@Hardesh /Gopenly.in

 

 

{
  "status"400,
  "message""{\"odata.error\":{\"code\":\"-1, Microsoft.SharePoint.Client.InvalidClientQueryException\",\"message\":{\"lang\":\"en-US\",\"value\":\"A type named 'SP.Data.Incidents.ListItem' could not be resolved by the model. When a model is available, each type name must resolve to a valid type.\"}}}\r\nclientRequestId: 48a64a77-c955-4d50-b606-04fa46bed8a8\r\nserviceRequestId: 35f157a0-e0ac-1000-752f-b56a3be9dfda",
  "source""https://.../sites/ITS-UserServices/_api/lists/getbytitle('Incidents')/items(42)",
  "errors": []
}
 
The above error occurred after changing to __metadata.

httprequest.png

Finally, I got it right as above.

Helpful resources

Announcements
Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,055)