Can anyone provide a code example of the following POST description from the API Reference pdf?
POST
/{sourceObjectPath}?destinationObjectPath={destinationObjectPath}&pasteAction={pasteAction}&repl
aceExisting={replaceExisting}
with actual paths, quotes and line ending as it would appear in code? Thank you.
Solved! Go to Solution.
Solved by jeremytammik. Go to Solution.
Dear Bryan,
Thank you for your query.
All I have off-hand is this old blog post with the happy conclusion 'works like a charm':
http://thebuildingcoder.typepad.com/blog/2014/01/rest-post-request-to-revit-server-2014.html
It is not much more explicit than your query, though.
As far as I know, you do not have to include any quotes or line endings in the request.
Replace the path separator character by the vertical bar sign '|'.
Avoid all spaces in file names.
That's about it, I think.
Any further quotes and stuff depend on your programming system.
The 'Revit Server REST API Reference.pdf' documentation includes an example:
Example:
The following example moves 00Folder\01CentralModel.rvt to 10Folder.
Request:
POST /10Folder|01CentralModel.rvt?destinationObjectPath=00Folder|01CentralModel.rvt&pasteAction=Move&replaceExisting=false User-Name: Tester 31 User-Machine-Name: TestMachine Operation-GUID: 45FB8158-8BE3-43E5-9DFA-318BDBCB4C93
Response:
HTTP/1.1 201 Created Content-Length: 0 Location: http://host/RevitServerAdminRESTService2017/10Folder|01CentralModel.rvt
Another solution would be to make use of the high-level Revit Server API library:
http://thebuildingcoder.typepad.com/blog/2017/02/revitserverapilib-truss-members-and-layers.html#2
Then you presumably don't have to deal with those nitty-gritty details yourself at all.
Alternatively, look into that library's source code to see how the POST request is formatted.
I hope this helps.
Best regards,
Jeremy
Can't find what you're looking for? Ask the community or share your knowledge.