Nov 23 2021 08:17 PM - edited Dec 07 2021 05:56 PM
Hi,
I'm trying to add entries to a project online lookuptable using REST. I'm able to create a project via similar commands, however I cannot get the body correct to "post" the additional entry(s) to the lookup table.
The remote server returned an error: (400) Bad Request.
I think its the Value I cannot get correct, which may be related to SP.KeyValue.
Supported.
PS.LookupEntryCreationInformation http://contoso.sharepoint.com/sites/pwa/api/ProjectServer/LookupTables('{tableid}')/Entries/Add
POST Example (not all fields may be required)
body = { 'parameters': { 'Description':'value', 'Id':'value', 'ParentId':'value', 'SortIndex':'value', 'Value':'value' }
}
Thanks
Nov 28 2021 06:27 PM
Nov 28 2021 07:20 PM - edited Nov 28 2021 07:58 PM
SolutionWorked it out in end, started off very simple body, the journey took me down the long and frustrating path to complex body with content-type using application/json;odata=verbose. Nailed it today with the below simple body and content-type just application/json.
For anyone wanting to add an entry to lookup table within project online the below if the URL and body required ensuring the GUID is unique for each entry.
http://contoso.sharepoint.com/sites/pwa/api/ProjectServer/LookupTables('{tableid}')/Entries/Add
Powershell
$lookupguid = [Guid]::NewGuid()
$body = "{ 'parameters':
{'Description': 'TEST REST DESC',
'Id': '$lookupguid',
'SortIndex': '0',
'Value': {
'DurationValue': null,
'NumberValue': '0',
'TextValue': 'TEST REST'
}}
}"