Select to view content in your preferred language

Save project to portal programmatically using API?

153
1
Jump to solution
a week ago
PärÅman
Occasional Contributor

I would like to save a project to portal using the API. At the moment this is not possible using the 3.5 API: https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Content-and-Items#create-portal-project

We've done it by just uploading the file, but it isn't working when trying to open the downloaded aprx-file. I guess there is more to the story.

using var client = new HttpClient();
var form = new MultipartFormDataContent
        {
            { new StringContent("json"), "f" },
            { new StringContent(auth.Token), "token" },
            { new StringContent("Pro Project"), "type" },
            { new StringContent(Path.GetFileNameWithoutExtension(aprxPath)), "title" },
            { new StringContent("true"), "overwrite" },
            { new StringContent("Uploaded APRX project"), "description" }
        };
// Attach APRX file
var fileContent = new StreamContent(File.OpenRead(tempFilePath));
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/octet-stream");
form.Add(fileContent, "file", filename);
// Send upload request
var response = await client.PostAsync(uploadUrl, form);

 

Is there a roadmap for when this feature will be available for us, 3.6 or later?

 

0 Kudos
1 Solution

Accepted Solutions
CharlesMacleod
Esri Regular Contributor

It is planned for 3.7

View solution in original post

1 Reply
CharlesMacleod
Esri Regular Contributor

It is planned for 3.7