API 1.3 changes

Hi,

I had some issues this week with the API 1.3 interfaces https://anaplan.docs.apiary.io/#reference

if you also have problems please try this:

  • PUT method to upload file: In the Header the Content-type should be application/octet-stream
  • GET method to download a file: In the Header delete the Accept:application/octet-stream

Regards

Answers

  • @ABerenguela 

     

    Thanks for sharing. 

  • @ABerenguela 

    I'll pass this on to our clients. Do you know when this was changed?

  • @JaredDolich in the last release

  • @ABerenguela 

    I didn't see anything in the release notes, so this might have been an "infrastructure upgrade". 

    Anyway, I tested the header change using this python script to download a file and it worked great! Thanks for the heads up!

     

    # This script downloads a file in chunks.

    import requests

    import base64

    import sys

    import json

    from getAuthentication import userBA

    from getGUIDs import wGuid, mGuid, fileID, fileName

     

    url = (f'https://api.anaplan.com/1/3/workspaces/{wGuid}/models/{mGuid}/' +

           f'files/{fileID}/chunks')

     

    getHeaders = {

        'Authorization': userBA

    }

     

    downloadHeaders = {

        'Authorization': userBA,

        'Accept': 'application/octet-stream'

    }

     

    getChunkData = requests.get(url,

                                headers=getHeaders)

    with open('downloadChunkData.json', 'wb') as f:

        f.write(getChunkData.text.encode('utf-8'))

     

    with open('downloadChunkData.json', 'r') as f:

        f2 = json.load(f)

     

    with open(f'{fileName}', 'wb') as f:

        for i in f2:

            chunkData = i

            chunkID = i['id']

            print(f'Getting chunk {chunkID}')

            getChunk = requests.get(url + f'/{chunkID}',

                                    headers=downloadHeaders)

            f.write(getChunk.content)

            print('Status code: ' + str(getChunk.status_code))