+20
-7
docs/graphql-api.md
+20
-7
docs/graphql-api.md
···
881
881
882
882
**Returns:**
883
883
884
-
- `blob`: A JSON blob object containing:
885
-
- `ref`: The CID (content identifier) reference for the blob
886
-
- `mimeType`: The MIME type of the uploaded blob
887
-
- `size`: The size of the blob in bytes
884
+
- `blob`: A Blob object containing:
885
+
- `ref` (String): The CID (content identifier) reference for the blob
886
+
- `mimeType` (String): The MIME type of the uploaded blob
887
+
- `size` (Int): The size of the blob in bytes
888
+
- `url` (String): CDN URL for the blob (supports presets)
888
889
889
890
**Example with Variables:**
890
891
···
897
898
898
899
**Usage in Records:**
899
900
900
-
After uploading a blob, use the returned blob object in your record mutations:
901
+
After uploading a blob, use the returned blob object in your record mutations. You can provide the blob as a complete object with `ref` as a String:
901
902
902
903
```graphql
903
904
mutation UpdateProfile($avatar: JSON) {
···
905
906
rkey: "self"
906
907
input: {
907
908
displayName: "My Name"
908
-
avatar: $avatar # Use the blob object from uploadBlob
909
+
avatar: $avatar # Blob object with ref as String (CID)
909
910
}
910
911
) {
911
912
uri
912
913
displayName
913
914
avatar {
914
-
ref
915
+
ref # Returns as String (CID)
915
916
mimeType
916
917
size
917
918
url(preset: "avatar")
···
919
920
}
920
921
}
921
922
```
923
+
924
+
**Example blob object for mutations:**
925
+
926
+
```json
927
+
{
928
+
"ref": "bafyreigbtj4x7ip5legnfznufuopl4sg4knzc2cof6duas4b3q2fy6swua",
929
+
"mimeType": "image/jpeg",
930
+
"size": 245678
931
+
}
932
+
```
933
+
934
+
**Note:** The GraphQL API automatically handles the conversion between the GraphQL format (where `ref` is a String containing the CID) and the AT Protocol format (where `ref` is an object `{$link: "cid"}`). You always work with `ref` as a simple String in GraphQL queries and mutations.
922
935
923
936
### Create Records
924
937