24 lines
942 B
OpenEdge ABL
24 lines
942 B
OpenEdge ABL
public class SubscriberContactController {
|
|
public Contact contact { get; set; }
|
|
|
|
public SubscriberContactController() {
|
|
HttpRequest req = new HttpRequest();
|
|
req.setEndpoint('http://yourwebsite.com/api/contact'); // replace with your API endpoint
|
|
req.setMethod('GET');
|
|
|
|
Http http = new Http();
|
|
HttpResponse res = http.send(req);
|
|
|
|
// Parse thee JSON response
|
|
if (res.getStatusCode() == 200) {
|
|
Map<String, Object> data = (Map<String, Object>) JSON.deserializeUntyped(res.getBody());
|
|
this.contact = new Contact();
|
|
this.contact.LastName = (String) data.get('fullName');
|
|
this.contact.Email = (String) data.get('email');
|
|
this.contact.Phone = (String) data.get('phone');
|
|
this.contact.Website__c = (String) data.get('website');
|
|
this.contact.Description = (String) data.get('message');
|
|
}
|
|
}
|
|
|
|
} |