-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstagram API.postman_collection.json
More file actions
557 lines (557 loc) · 17.8 KB
/
Instagram API.postman_collection.json
File metadata and controls
557 lines (557 loc) · 17.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
{
"info": {
"_postman_id": "9386f468-7714-490f-9bfc-9442db5c8f00",
"name": "Instagram API",
"description": "This collection will allow you to connect to [Instagram's Graph API](https://developers.facebook.com/docs/instagram-api/), which allows Instagram Professionals - Businesses and Creators - to manage their presence on the platform. This guide will help you to **generate tokens**, **publish content**, **gather insights** and **manage an Instagram profile**.\n\nThe API is built on top of Facebook's Graph API, we recommend giving [this guide](https://developers.facebook.com/docs/graph-api/) a look before getting started.\n\n# Before You Start\n\nTo interact with the API, you must first have a Facebook App. You can create one following this [guide](https://desktop.postman.com/?desktopVersion=9.31.0&webVersion=9.31.22-ui-221031-1419&userId=19667706&teamId=3121756), for the purposes of the guide, we recommend using a `Business` App.\n\nAfter creating the app, you must generate a **User Access Token** with it. This token will allow you to manage permissions and objects you manage, you can generate it with this [guide](https://desktop.postman.com/?desktopVersion=9.31.0&webVersion=9.31.22-ui-221031-1419&userId=19667706&teamId=3121756). Afterwards, make sure to select the `Instagram` environment in Postman and paste the resulting token under the `user_access_token` variable.\n\nThe permission model for the API requires a **Page** to be linked with a [Professional Instagram Account](https://help.instagram.com/502981923235522?fbclid=IwAR1jt_4CNiu3TFxV6AN9wpI2EUy59TtxnrZP1RJuSUOZhuReTezFMs1cAAc) before starting. Linking process can be found [here](https://www.facebook.com/help/1148909221857370).\n\n## Access Token Permissions needed\n\nThese are the permissions needed for the requests in this collection:\n\n- `pages_show_list`\n- `instagram_basic`\n- `instagram_content_publish`\n- `pages_read_engagement`\n- `instagram_manage_comments`",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "15138568",
"_collection_link": "https://www.postman.com/meta/instagram/collection/6yqw8pt/instagram-api?action=share&source=collection_link&creator=15138568"
},
"item": [
{
"name": "Token",
"item": [
{
"name": "Get Access Tokens of Pages You Manage",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "User-Agent",
"value": "Postman/InstagramCollection",
"type": "text"
}
],
"url": {
"raw": "https://graph.facebook.com/{{api_version}}/me/accounts?fields=name,access_token,tasks,instagram_business_account&access_token={{user_access_token}}",
"protocol": "https",
"host": [
"graph",
"facebook",
"com"
],
"path": [
"{{api_version}}",
"me",
"accounts"
],
"query": [
{
"key": "fields",
"value": "name,access_token,tasks,instagram_business_account"
},
{
"key": "access_token",
"value": "{{user_access_token}}"
}
]
},
"description": "This request uses a **User Access Token** to get a list of all the pages managed by a User. Make sure to choose one page from the list, copy the `ID` into the `page_id` variable, the `access_token` field into the `page_access_token` variable of the environment and the `instagram_business_account` field into the `ig_user_id` variable.\n\nThis new access token is a **Page Access Token**, which acts on behalf of a Page that is linked to an Instagram profile.\n\nMore available fields can be found [here](https://developers.facebook.com/docs/graph-api/reference/page/#fields)."
},
"response": [
{
"name": "Get Access Tokens of Pages You Manage",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "User-Agent",
"value": "Postman/InstagramCollection",
"type": "text"
}
],
"url": {
"raw": "https://graph.facebook.com/{{api_version}}/me/accounts?fields=name,access_token,tasks,instagram_business_account&access_token={{user_access_token}}",
"protocol": "https",
"host": [
"graph",
"facebook",
"com"
],
"path": [
"{{api_version}}",
"me",
"accounts"
],
"query": [
{
"key": "fields",
"value": "name,access_token,tasks,instagram_business_account"
},
{
"key": "access_token",
"value": "{{user_access_token}}"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [],
"cookie": [],
"body": "{\n \"data\": [\n {\n \"name\": \"{page_name}\",\n \"access_token\": \"{page_access_token}\",\n \"instagram_business_account\": {\n \"id\": \"{ig_user_id}\"\n },\n \"id\": \"{page_id}\",\n \"tasks\": [\n \"ANALYZE\",\n \"ADVERTISE\",\n \"MESSAGING\",\n \"MODERATE\",\n \"CREATE_CONTENT\",\n \"MANAGE\"\n ]\n }\n //...\n ]\n}"
}
]
},
{
"name": "Get Specific Page Access Token",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "User-Agent",
"value": "Postman/InstagramCollection",
"type": "text"
}
],
"url": {
"raw": "https://graph.facebook.com/{{api_version}}/{{page_id}}?fields=name,access_token,instagram_business_account&access_token={{user_access_token}}",
"protocol": "https",
"host": [
"graph",
"facebook",
"com"
],
"path": [
"{{api_version}}",
"{{page_id}}"
],
"query": [
{
"key": "fields",
"value": "name,access_token,instagram_business_account"
},
{
"key": "access_token",
"value": "{{user_access_token}}"
}
]
},
"description": "If you already have the `page_id` available, you can query directly this endpoint to get the specific **Page Access Token** you need and avoid having to search for it on the list.\n\nMore available fields can be found [here](https://developers.facebook.com/docs/graph-api/reference/page/#fields)."
},
"response": [
{
"name": "Get Specific Page Access Token",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "User-Agent",
"value": "Postman/InstagramCollection",
"type": "text"
}
],
"url": {
"raw": "https://graph.facebook.com/{{api_version}}/{{page_id}}?fields=name,access_token,instagram_business_account&access_token={{user_access_token}}",
"protocol": "https",
"host": [
"graph",
"facebook",
"com"
],
"path": [
"{{api_version}}",
"{{page_id}}"
],
"query": [
{
"key": "fields",
"value": "name,access_token,instagram_business_account"
},
{
"key": "access_token",
"value": "{{user_access_token}}"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [],
"cookie": [],
"body": "{\n \"name\": \"{page_name}\",\n \"access_token\": \"{page_access_token}\",\n \"instagram_business_account\": {\n \"id\": \"{ig_user_id}\"\n },\n \"id\": \"{page_id}\"\n}"
}
]
}
],
"description": "An access token is a string that identifies a user, app or IG User and is used by an app to make Graph API calls. This section will cover the basics of tokens used for the Instagram API. Make sure the `Instagram` environment is active and the `user_access_token` variable has a value."
},
{
"name": "Reels Publishing",
"item": [
{
"name": "Upload a Reel to an IG Container",
"event": [
{
"listen": "test",
"script": {
"exec": [
"if (pm.response.code==200)",
"{",
" var jsonData = JSON.parse(responseBody);",
" pm.collectionVariables.set(\"ig_container_id\", jsonData.id);",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "User-Agent",
"value": "Postman/InstagramCollection",
"type": "text"
}
],
"url": {
"raw": "https://graph.facebook.com/{{api_version}}/{{ig_user_id}}/media?media_type=REELS&video_url={{video_url}}&caption=Hello World!&share_to_feed=false&access_token={{page_access_token}}",
"protocol": "https",
"host": [
"graph",
"facebook",
"com"
],
"path": [
"{{api_version}}",
"{{ig_user_id}}",
"media"
],
"query": [
{
"key": "media_type",
"value": "REELS"
},
{
"key": "video_url",
"value": "{{video_url}}"
},
{
"key": "caption",
"value": "Hello World!"
},
{
"key": "share_to_feed",
"value": "false",
"description": "If set to true, the reel will appear in both the Feed and Reels tab. If it's set to false, it will only appear in the Reels tab."
},
{
"key": "access_token",
"value": "{{page_access_token}}"
}
]
},
"description": "This request will create an IG Container to hold the Reel. It will return a `container_id` that will be automatically placed into the `ig_container_id` variable. The `media_type` parameter will determine the type of video published, in this case REELS. It is important that the link in the `video_url` variable is accessible publicly as we will cURL the video from the server."
},
"response": [
{
"name": "Upload a Reel to an IG Container",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "User-Agent",
"value": "Postman/InstagramCollection",
"type": "text"
}
],
"url": {
"raw": "https://graph.facebook.com/{{api_version}}/{{ig_user_id}}/media?media_type=REELS&video_url={{video_url}}&caption=Hello World!&share_to_feed=false&access_token={{page_access_token}}",
"protocol": "https",
"host": [
"graph",
"facebook",
"com"
],
"path": [
"{{api_version}}",
"{{ig_user_id}}",
"media"
],
"query": [
{
"key": "media_type",
"value": "REELS"
},
{
"key": "video_url",
"value": "{{video_url}}"
},
{
"key": "caption",
"value": "Hello World!"
},
{
"key": "share_to_feed",
"value": "false",
"description": "If set to true, the reel will appear in both the Feed and Reels tab. If it's set to false, it will only appear in the Reels tab."
},
{
"key": "access_token",
"value": "{{page_access_token}}"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [],
"cookie": [],
"body": "{\n \"id\": \"18270815569115548\"//IG Container ID\n}"
}
]
},
{
"name": "Get IG Container Status",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "User-Agent",
"value": "Postman/InstagramCollection",
"type": "text"
}
],
"url": {
"raw": "https://graph.facebook.com/{{api_version}}/{{ig_container_id}}?fields=status_code,status&access_token={{page_access_token}}",
"protocol": "https",
"host": [
"graph",
"facebook",
"com"
],
"path": [
"{{api_version}}",
"{{ig_container_id}}"
],
"query": [
{
"key": "fields",
"value": "status_code,status"
},
{
"key": "access_token",
"value": "{{page_access_token}}"
}
]
},
"description": "After generating the IG Container, this request will allow you to monitor the status of the upload. Once the `status_code` is `FINISHED`, you'll be able to publish the Reel in the next request."
},
"response": [
{
"name": "Get IG Container Status",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "User-Agent",
"value": "Postman/InstagramCollection",
"type": "text"
}
],
"url": {
"raw": "https://graph.facebook.com/{{api_version}}/{{ig_container_id}}?fields=status_code,status&access_token={{page_access_token}}",
"protocol": "https",
"host": [
"graph",
"facebook",
"com"
],
"path": [
"{{api_version}}",
"{{ig_container_id}}"
],
"query": [
{
"key": "fields",
"value": "status_code,status"
},
{
"key": "access_token",
"value": "{{page_access_token}}"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [],
"cookie": [],
"body": "{\n \"status_code\": \"FINISHED\",\n \"status\": \"Finished: Media has been uploaded and it is ready to be published.\",\n \"id\": \"18270815569115548\" //IG Container ID\n}"
}
]
},
{
"name": "Publish Reel",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "User-Agent",
"value": "Postman/InstagramCollection",
"type": "text"
}
],
"url": {
"raw": "https://graph.facebook.com/{{api_version}}/{{ig_user_id}}/media_publish?creation_id={{ig_container_id}}&access_token={{page_access_token}}",
"protocol": "https",
"host": [
"graph",
"facebook",
"com"
],
"path": [
"{{api_version}}",
"{{ig_user_id}}",
"media_publish"
],
"query": [
{
"key": "creation_id",
"value": "{{ig_container_id}}"
},
{
"key": "access_token",
"value": "{{page_access_token}}"
}
]
},
"description": "This request finalizes the Reels Publishing process and posts the Reel into a User's profile."
},
"response": [
{
"name": "Publish Reel",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "User-Agent",
"value": "Postman/InstagramCollection",
"type": "text"
}
],
"url": {
"raw": "https://graph.facebook.com/{{api_version}}/{{ig_user_id}}/media_publish?creation_id={{ig_container_id}}&access_token={{page_access_token}}",
"protocol": "https",
"host": [
"graph",
"facebook",
"com"
],
"path": [
"{{api_version}}",
"{{ig_user_id}}",
"media_publish"
],
"query": [
{
"key": "creation_id",
"value": "{{ig_container_id}}"
},
{
"key": "access_token",
"value": "{{page_access_token}}"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [],
"cookie": [],
"body": "{\n \"id\": \"90011803596441\"//IG Media ID\n}"
}
]
}
],
"description": "This section allows developers to upload and publish a Reel into an Instagram User from a server.\n\nFor this section, you'll need to introduce a video link into the `video_url` variable. It needs to follow these specifications:\n\n- Container: MOV or MP4 (PMEG-4 Part 14)\n- Audio codec: AAC, 48khz\n- Video codec: HEVC or H.264\n- Frame rate: 23-60 FPS\n- Picture size:\n - Maximum 1920 horizontal pixels\n - Recommended aspect ratio 9:16\n- Video bitrate: 25 Mbps maximum\n- Audio bitrate: 128 kbps\n- Duration 15 minutes maximum, 3 seconds minimum\n- File size: 1 GB maximum\n \n\nMore information about Reels Publishing can be found [here](https://developers.facebook.com/docs/instagram-api/guides/content-publishing/#reels-posts)."
}
],
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
],
"variable": [
{
"key": "ig_media_id",
"value": "",
"type": "string"
},
{
"key": "comment_id",
"value": "",
"type": "string"
},
{
"key": "ig_container_id",
"value": "",
"type": "string"
}
]
}