App Store Connect API: Create New Profile - 500 Error

URL: POST /v1/profiles

RETURN CONTENT:

{
    "errors":[
        {
            "status":"500",
            "code":"UNEXPECTED_ERROR",
            "title":"An unexpected error occurred.",
            "detail":"An unexpected error occurred on the server side. If this issue continues, contact us at https://developer.apple.com/contact/."
        }
    ]
}

(I have already check the system status on https://developer.apple.com/system-status/ , API service is running)

PROGRAMING LANGUAGE: PHP

CODE:

<?php

$data = array(
    'data' => array(
        'attributes' => array(
            'name' => $_GET['bid'],
            'profileType' => 'IOS_APP_DEVELOPMENT'
        ),
        'relationships' => array(
            'bundleId' => array(
                'data' => array(
                    'id' => $_GET['bid'],
                    'type' => 'bundleIds'
                )
            ),
            'certificates' => array(
                'data' => array(
                    'id' => $_GET['cid'],
                    'type' => 'certificates'
                )
            ),
            // 'devices' => array(
            //     'data' => array(
            //         'id' => $_GET['udid'],
            //         'type' => 'devices'
            //     )
            // )
        ),
        'type' => 'profiles'
    )
);

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.appstoreconnect.apple.com/v1/profiles',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => json_encode($data),
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Bearer '.$_GET['token']
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

?>

Hello @Ty_yqs,

Are you still encountering this problem?

Are you able to successfully generate an App Store profile? I would recommend starting with that in order to make sure that your code works for a simpler profile rather than a development one.

Inside of the small code sample that you provided, it looks like there is an extra , in the JSON that is being provided to the API at the end of the certificates section, but I am not sure if that is contributing to the issue.

Looking forward to helping if you are still running into this issue!

App Store Connect API: Create New Profile - 500 Error
 
 
Q