The JSON generated with v4 generated using v4 is not properly encoded JSON.
When testing with Python3, I received this error.
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 12 column 9 (char 450)
I determined the issue below.
The issue presents itself across all languages it seems (which makes sense because it deals with the code that produces the JSON string, rather than the auto-generated code). Note that I only tested Python3, but the JSON string is the same for each code sample.
The suggested Python3 request is the following.
import requests
values = """
{
"message": "Hello!",
"channelName": "My New Channel",
"subtitle": "This is my subtitle!",
"body": "This is a body. This only appears once the user opens the application.",
"link": "https://google.com",
"schedule": "1591982947",
"expirationStamp": "1592414947",
"openLinkInApp": "true",
"iOSDeepLink": "photos-redirect://",
}
"""
headers = {
'Content-Type': 'application/json',
'X-Authorization': 'YOUR-SECRET-KEY',
'X-UserId': 'your_user_id'
}
response = requests.post('https://api.spontit.com/v3/push', data=values, headers=headers)
print(response.status_code)
print(response.headers)
print(response.json())
This is not valid JSON.
See the line "iOSDeepLink": "photos-redirect://",. There is a comma where there should not be. This results in invalid JSON that cannot be decoded. And then the request fails.
The JSON generated with v4 generated using v4 is not properly encoded JSON.
When testing with Python3, I received this error.
I determined the issue below.
The issue presents itself across all languages it seems (which makes sense because it deals with the code that produces the JSON string, rather than the auto-generated code). Note that I only tested Python3, but the JSON string is the same for each code sample.
The suggested Python3 request is the following.
This is not valid JSON. See the line "iOSDeepLink": "photos-redirect://",. There is a comma where there should not be. This results in invalid JSON that cannot be decoded. And then the request fails.