Как код приложения Salesforce оснастки интерфейса API для C#
Необходимо знать, как кодировать Salesforce Tooling API на языке C#... Код показывает ошибки...
Что я уже пробовал:
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Globalization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System.Web; using System.Web.Http; namespace GenieAPI.Controllers { public class ToolingWebApiController : ApiController { public ToolingWebApiController() { Http http = new Http(); } public HttpResponse createLightingWEBComponent(String cmponentName) { HttpRequest request = createHttpRequest('POST'); request.setEndpoint('/services/data/v45.0/sobjects/LightningComponentBundle'); JSONGenerator gen = Json.createGenerator(true); gen.writeStartObject(); gen.writeStringField('FullName', cmponentName); gen.writeFieldName('Metadata'); gen.writeStartObject(); gen.writeStringField('masterLabel', cmponentName); gen.writeEndObject(); gen.writeEndObject(); request.setBody(gen.getAsString()); return sendRequest(request); } public HttpResponse createLightingWEBComponentFile(String componentId, String componentName, String filename, String format, String body) { //List<String> supportedFormats=new List<String>{'css','html','js','xml'}; HttpRequest request = createHttpRequest('POST'); request.setEndpoint('/services/data/v45.0/sobjects/LightningComponentResource '); JSONGenerator gen = Json.createGenerator(true); gen.writeStartObject(); gen.writeStringField('LightningComponentBundleId', componentId); gen.writeStringField('FilePath', 'lwc/' + componentName + '/' + filename); gen.writeStringField('Format', format); gen.writeStringField('Source', body); gen.writeEndObject(); request.setBody(gen.getAsString()); return sendRequest(request); } private HttpRequest createHttpRequest(String requestType) { HttpRequest request = new HttpRequest(); request.setEndpoint(URL.getSalesforceBaseUrl().toExternalForm() + '/services/data/v45.0/tooling'); request.setHeader('Authorization', 'OAuth ' + UserInfo.getSessionId()); request.setHeader('Content-Type', 'application/json'); request.setMethod(requestType); return request; } } } }