1

I am creating a flow right now that will create pages every week. The thing is, im using the "Send an HTTP request to sharepoint" to create the pages. Below you can see that part: enter image description here

The problem is, whenever I start the flow, it shows me the following error:

{
  "status": 400,
  "message": "Invalid JSON. A comma character ',' was expected in scope 'Object'. Every two elements in an array and properties of an object must be separated by commas.\r\nclientRequestId: 8fc18d2f-80e8-4705-98fe-98fb9c1e7b98\r\nserviceRequestId: 0283ad9e-9062-0000-37db-27d19952771c",
  "source": "https://XXXXXXX.sharepoint.com/sites/(SiteName)/(SubSite Name)/_api/web/lists/getbytitle('Pages')/items",
  "errors": [
    "-1",
    "Microsoft.SharePoint.Client.InvalidClientQueryException"
  ]
}

When i add that come to the object it says, the comma can't be there. So i assume the problem isn't about the comma, but rather about the coding itself, but i can't figure it out... Can someone help me?

EDIT: I am also using taxonomy fields, maybe that's why there is this error?

1
  • The JSON in the body seems fine, but I would check the values you add using the dynamics elements. Maybe one of them contains a value that makes the JSON invalid?
    – Andreas
    Oct 30, 2020 at 13:25

4 Answers 4

0

Might not be an answer, but I'm adding my 2 cents.

The JSON seems to be valid from the first glance. Although:

  • You can remove all headers. These should be inserted automatically by the SharePoint's HTTP action.
  • x-ReuqestDigest is not going to work: $("#_REQUESTDIGEST").val() is a jQuery function that tries to find a hidden input with an ID _REQUESTDIGEST from a web page. You don't have a) jQuery or a b) webpage. Nor can you run any JavaScript from an MS Flow.

How about creating a page using create SharePoint list item action instead of HTTP? Does it not work for you because you need to specify a content type?

2
  • I can't create a page using 'Create a List item' because my fields are Publishing HTML. Flow doesn't recognize Publishing HTML fields, when using 'create an item' actions, therefore im basically forced to use this...
    – João
    Dec 20, 2018 at 8:13
  • When i remove the "RequestDigest", it still shows me the error.
    – João
    Dec 20, 2018 at 8:36
0

In body use single quote(') instead of double quote (") and it will work.

1
  • It did not work...
    – João
    Feb 5, 2019 at 14:45
0

Make sure the content of the body use a single quote.

Example:

{ 
    '__metadata': { 'type': 'SP.Data.SampleListItem' },
    'Title': '~actual content~'
}

Try to use replace(~actual content~,'''','\''') to pass the redefined data.

By using the above code all the single quotes will be replaced with double single quotes, and the data will be parsed with no errors.

0

I had the exact same issue. It really was a comma that was the issue.

Here is what I started with:

 {
'fAllDayEvent' : 'True',
}

I had to remove that comma since there is no element following the fAllDayEvent.

I am wondering about your Content-Type ID. I think it would either belong at the top of the body statement or in the header section. You might look into that and then remove the comma after the last element in the body.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.