dgielis
3/13/2018 - 11:05 AM

Load Oracle APEX Team Development into Bitbucket issues

Load Oracle APEX Team Development into Bitbucket issues

declare
  l_clob clob;
  l_body clob;
begin
  for r in (select feature_name as title, '*'||focus_area||'*' ||feature_description || ' ' || publishable_description || '' as description 
              from apex_team_features
             where nvl(feature_status,0) < 100 and nvl(focus_area,'A') <> 'ON HOLD')
                   -- change where to what you need
  loop  
    apex_json.initialize_clob_output;
    apex_json.open_object;
    apex_json.write(p_name => 'title', p_value => r.title);
    apex_json.open_object(p_name => 'content');
    apex_json.write(p_name => 'raw', p_value => r.description);
    apex_json.close_object;
    apex_json.close_object;
    l_body := apex_json.get_clob_output;
    apex_json.free_output;

    apex_web_service.g_request_headers(1).name := 'Content-Type';
    apex_web_service.g_request_headers(1).value := 'application/json';
    
    l_clob := apex_web_service.make_rest_request(
        p_url => 'https://api.bitbucket.org/2.0/repositories/owner/repo/issues',
        p_http_method => 'POST',
        p_username => 'xxx',
        p_password => 'xxx',
        p_body => l_body);
  end loop;
end;