Push credentials


Push credentials

Push credentials are required for the purpose of sending push notifications to a native application. Push credentials must be defined for the application.

The push credentials endpoint implements functions to create, read, update and delete the push credentials associated with native application resources.

There are two types of push credentials:

  • APNS
  • FCM

Note: The request bodies, their mandatory properties and responses vary according to the push credential type.

Push credentials API operations

The push credentials endpoints support the following operations:

For hands-on experience with the applications API endpoints, click the Run in Postman button below to download a Postman collection that you can import and open in your local Postman application.

Push credentials data model

Property Description
type A string that specifies the type of the push credentials.
Mandatory.
Valid values:
  • APNS
  • FCM
key A string that Apple uses as an identifier to identify an authentication key.
Mandatory.
teamId A string that Apple uses as an identifier to identify teams.
  • Mandatory for APNS.
  • Should be left empty for FCM.
token A string that Apple uses as the authentication token signing key to securely connect to APNS. This is a p8 file with a private key format.
  • Mandatory for APNS.
  • Should be left empty for FCM.

Response codes

Code Message
200 Successful operation.
201 Successfully created.
204 Successfully removed. No content.
400 The request could not be completed.
401 You do not have access to this resource.
403 You do not have permissions or are not licensed to make this request.
404 The requested resource was not found.
500 Unexpected server error.

Endpoint examples

Create push credentials

The following samples shows the POST /environments/{environmentId}/applications/{applicationId}/pushCredentials operation to create the push credentials for the application in the specified environment resource.

  • APNS
curl -X POST "https://api.pingone.com/v1/environments/environments/{environmentId}/applications/{applicationId}/pushCredentials" \
-H "Content-type: application/json" \
-H "Authorization: Bearer jwtToken" \
-d "{
  "type": "APNS", 
  "key": "1U2ZP3G45W", 
  "teamId": "ABCXYZ1234", 
  "token": "-----BEGIN PRIVATE KEY-----\nMIGTAgEA****7HUikGZU\n-----END PRIVATE KEY-----"
}"
  • FCM:
curl -X POST "https://api.pingone.com/v1/environments/environments/{environmentId}/applications/{applicationId}/pushCredentials" \
-H "Content-type: application/json" \
-H "Authorization: Bearer jwtToken" \
-d "{
  "type": "FCM", 
  "key": "1U2ZP3G45W", 
}"

The request URL identifies the environment ID and application ID. The request body specifies the type and the key attribute values. When the type is “APNS”, the request also specifies the teamId and the token attribute values.

Since key, teamId and token are considered credentials, these fields can be created with a POST request and updated with a PUT request, but are not returned by a GET request.

Get push credentials

The GET /environments/{environmentId}/applications/{applicationId}/pushCredentials/{pushCredentialsId} operation returns the push credentials assigned to the application specified by the application ID.

curl -X GET "https://api.pingone.com/v1/environments/{environmentId}/applications/{applicationId}/pushCredentials/{pushCredentialsId}" \
-H "Authorization: Bearer jwtToken"

The request URL identifies the environment ID and the application’s ID. The response data looks like this.

{
    "_links": {
        "self": {
            "href": "https://api.pingone.com/v1/environments/f59504de-3c45-4a37-8d70-d5ad75dfaaa0/applications/5e81bba1-5185-457c-926a-aae0e8939109/pushCredentials/40de73de-ba62-494c-b605-4da440421fee"
        },
        "environment": {
            "href": "https://api.pingone.com/v1/environments/f59504de-3c45-4a37-8d70-d5ad75dfaaa0"
        },
        "application": {
            "href": "https://api.pingone.com/v1/environments/f59504de-3c45-4a37-8d70-d5ad75dfaaa0/applications/5e81bba1-5185-457c-926a-aae0e8939109"
        }
    },
    "id": "40de73de-ba62-494c-b605-4da440421fee",
    "environment": {
        "id": "f59504de-3c45-4a37-8d70-d5ad75dfaaa0"
    },
    "application": {
        "id": "5e81bba1-5185-457c-926a-aae0e8939109"
    },
    "createdAt": "2019-06-03T11:04:05.250Z",
    "updatedAt": "2019-06-03T11:04:05.250Z",
    "type": "FCM"
}

Since key, teamId and token are considered credentials, these fields can be created with a POST request and updated with a PUT request, but are not returned by a GET request.

Update push credentials

The following sample shows the PUT /environments/{environmentId}/applications/{applicationId}/pushCredentials/{pushCredentialsId} operation to update the push credentials specified by its ID in the request URL. The push credentials are updated only for the application identified in the request URL.

curl -X PUT "https://api.pingone.com/v1/environments/{environmentId}/applications/{applicationId}/pushCredentials/{pushCredentialsId}" \
-H "Authorization: Bearer jwtToken" \

Since key, teamId and token are considered credentials, these fields can be created with a POST request and updated with a PUT request, but are not returned by a GET request.

Delete push credentials

The following sample shows the DELETE /environments/{environmentId}/applications/{applicationId}/pushCredentials/{pushCredentialsId} operation to delete the push credentials specified by its ID in the request URL. The push credentials are deleted only for the application identified in the request URL.

curl -X DELETE "https://api.pingone.com/v1/environments/{environmentId}/applications/{applicationId}/pushCredentials/{pushCredentialsId}" \
-H "Authorization: Bearer jwtToken" \

When successful, the DELETE request returns a code 204 No Content message.